Re: Some interesting results from tweaking spinlocks

From: Brent Verner <brent(at)rcfile(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Some interesting results from tweaking spinlocks
Date: 2002-01-06 01:48:45
Message-ID: 20020106014845.GA8280@rcfile.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

[2002-01-05 17:04] Tom Lane said:
| Brent Verner <brent(at)rcfile(dot)org> writes:
| > Using a single-processor machine, we're not going to get any lower
| > sleep times than ~10ms from either usleep or select on linux, and
| > usleep is always longer.
|
| Ah, so usleep is just being stricter about rounding up the requested
| delay? That would explain the results all right.

The only difference I see is that sys_nanosleep gets its actual timeout
value using timespec_to_jiffies(), and do_select leaves the specified
delay untouched.

| > Looks like increasing spins allows
| > the process to get the lock before the usleep/select is run
|
| Right. Up to a point, increasing spins improves the odds of acquiring
| the lock without having to release the processor.
|
| What I should've thought of is to try sched_yield() as well, which is
| the operation we *really* want here, and it is available on this version
| of Linux. Off to run another batch of tests ...

yes. using just sched_yield() inside the TAS loop appears to give
better performance on both freebsd and linux (single-proc); in
particular, it _looks_ like there is a 8-10% performance gain at
32 clients.

btw, what are y'all using to generate these nifty graphs?

thanks.
brent

--
"Develop your talent, man, and leave the world something. Records are
really gifts from people. To think that an artist would love you enough
to share his music with anyone is a beautiful thing." -- Duane Allman

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2002-01-06 01:53:43 Re: Some interesting results from tweaking spinlocks
Previous Message Tom Lane 2002-01-05 22:04:36 Re: Some interesting results from tweaking spinlocks