[patch] waitqueue optimization, 2.4.0-test7

From: Ingo Molnar (mingo@elte.hu)
Date: Mon Aug 28 2000 - 08:49:24 EST


a substantial percentage of __wake_up() calls are done on empty waitqueues
- the percentage in a typical system is around 50% but can be higher under
various loads. The attached waitqueue-2.4.0-test7-A1 patch optimizes
wake_up() to check wether the waitqueue is empty before calling
__wake_up(). This optimization is especially useful on SMP systems - the
waitqueue spinlock is not taken thus causes no cacheline ping-pong. But
there are benefits on UP systems as well, the cli/sti pair in __wake_up is
not executed in these cases and we avoid the function call as well.

the wake_up() variants could be optimized further if we didnt allow NULL
pointers being passed to wake_up() - but this i think is a 2.5 item as it
changes the wake_up() interface. I've done this optimization too, and
there are not that many places that pass NULL to wake_up() - but it
happens often enough to cause trouble if done now.

there is the question of synchronization with the waitqueue lock on SMP
systems - the waitqueue_active() check goes outside the waitqueue
spinlock, but i think this is safe. I didnt see any problems whatsoever.

        Ingo



-
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 : Thu Aug 31 2000 - 21:00:21 EST