Re: Linux 2.2.19pre2

From: Andrew Morton (andrewm@uow.edu.au)
Date: Sat Dec 23 2000 - 01:56:42 EST


Andrea Arcangeli wrote:
>
> [ 2.2 waitqueue stuff ]
>

Andrea, it occurs to me...

__wake_up() is using read_lock(waitqueue_lock). This means that
two CPUs could simultaneously run __wake_up(). They could both
find the same task and they could both try to wake it up. The
net result would be two wakeup events, but only one task woken
up. That's a lost wakeup.

Now, it's probably the case that the 2.2 network serialisation
prevents this from happening - I haven't looked. If not,
then we need to use spin_lock_irqsave.

Alternatively, we can teach wake_up_process to return a success
value if it successfully moved a task onto the runqueue. Test that
in __wake_up and keep on going if it's zero.

2.4 needs this as well, BTW, to fix an SMP race where a task is on two
waitqueues at the same time. I did a patch which took the "wake_up_process
returns success value" approach and it felt clean. I haven't submitted
it due to general end-of-year patch exhaustion :)

If we elect to not address this problem in 2.2 and to rely upon the network
locking then we need to put a BIG FAT warning in the code somewhere, because
if someone else tries to use the new wake-one capability, they may not be
so lucky.

-
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Dec 23 2000 - 21:00:33 EST