So why couldn't this happen? This is what used to happen before, I don't
see that consolidating the spinlock had any impact at all.
CPU #0 CPU #1
down() up()
lock decl (negative)
__down() lock incl
spinlock() __up()
atomic_add_negative()
success - break
spinunlock();
} wake_up()
return - semaphore is now invalid spin_lock()
BOOM!
The fact is, that as long as down() and up() avoid taking the spinlock
_before_ they touch "count", they aren't synchronized.
And we definitely do _not_ want to take the spinlock before we touch
count, since that would make the fast path a lot slower.
What?
Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/