Cc: Zhang, Yanmin <yanmin_zhang@...>, Andi Kleen <andi@...>, Matthew Wilcox <matthew@...>, LKML <linux-kernel@...>, Alexander Viro <viro@...>, Andrew Morton <akpm@...>, Thomas Gleixner <tglx@...>, H. Peter Anvin <hpa@...>
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
--