Re: [patch] scheduler fixes, 2.5.32-BK

Linus Torvalds (torvalds@transmeta.com)
Fri, 30 Aug 2002 10:03:15 -0700 (PDT)


On Fri, 30 Aug 2002, Ingo Molnar wrote:
>
> actually, i think the race does not exist. up() is perfectly safely done
> on the on-stack semaphore, because both the wake_up() done by __up() and
> the __down() path takes the waitqueue spinlock, so i cannot see where
> the up() touches the semaphore after the down()-ed task has been woken
> up.

It touches the _spinlock_.

Which may no longer be a spinlock, since the waiter may never have blocked
on it at all, and may have just succeeded directly with the atomic
decrement of the counter.

Trust me, semaphores on the stack do not work unless there is some other
synchronization above the semaphore level (or unless we make semaphores
much slower, ie we take the spinlock even in the fast path).

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/