lkml.org 
[lkml]   [2008]   [May]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch] speed up / fix the new generic semaphore code (fix AIM7 40% regression with 2.6.26-rc1)


On Thu, 8 May 2008, Ingo Molnar wrote:
>
> Peter pointed it out that because sem->count is u32, the <= 0 is in fact
> a "== 0" condition - the patch below does that. As expected gcc figured
> out the same thing too so the resulting code output did not change. (so
> this is just a cleanup)

Why don't we just make it do the same thing that the x86 semaphores used
to do: make it signed, and decrement unconditionally. And callt eh
slow-path if it became negative.

IOW, make the fast-path be

spin_lock_irqsave(&sem->lock, flags);
if (--sem->count < 0)
__down();
spin_unlock_irqrestore(&sem->lock, flags);

and now we have an existing known-good implementation to look at?

Rather than making up a totally new and untested thing.

Linus


\
 
 \ /
  Last update: 2008-05-08 18:05    [W:0.150 / U:0.180 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site