Re: Some interesting results from tweaking spinlocks - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Some interesting results from tweaking spinlocks
Date
Msg-id 13361.1010268276@sss.pgh.pa.us
Whole thread Raw
In response to Re: Some interesting results from tweaking spinlocks  (Brent Verner <brent@rcfile.org>)
Responses Re: Some interesting results from tweaking spinlocks  (Brent Verner <brent@rcfile.org>)
List pgsql-hackers
Brent Verner <brent@rcfile.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.

> 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 ...
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: LWLock contention: I think I understand the problem
Next
From: Brent Verner
Date:
Subject: Re: Some interesting results from tweaking spinlocks