This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [parisc-linux] Re: [PATCH] Fix the atomic compare and swap


On 5/21/07, John David Anglin <dave@hiauly1.hia.nrc.ca> wrote:
In the linuxthread case, user spinlock code would typically spin a
few times and then call nanosleep.  If this fails a few times, the code
calls sched_yield.  From a performance standpoint, I don't think it helps
to waste time in the loop itself.

Yielding the cpu is intended to allow the other threads to make progress on this or other cpus. It would be wasetful to busy wait your entire time slice on your cpu, while another thread on another cpu is doing an LWS CAS.

On the otherhand, the atomic operations on the gateway page are short,
and processes on the gateway page are never supposed to be scheduled
off or sent signals.  So, I think a contended lock is only possible
with a SMP kernel.

That is correct. A contended lock is only possible on SMP. This issue only arose when we started using LWS CAS on the 64-bit SMP systems available as debian build servers. A UP kernel never retruns EAGAIN.

> I hadn't considered this code would be an external API, but I guess it
> is... so these defines should probably go away and the constants
> merged into the code?

Yah, this just occurred to me.  It would be nice if the code could
use EAGAIN from errno.h but I can see that that's a bit tricky.
Possibly, a macro argument would work.

I don't want to be at the *whim* of users who might redefine EAGAIN. I think the value should be fixed and immutable.

Comments?

Cheers,
Carlos.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]