Re: Any documentation anywhere on the new wait.h?

Ingo Molnar (mingo@chiara.csoma.elte.hu)
Thu, 1 Jul 1999 15:23:10 +0200 (CEST)


On Thu, 1 Jul 1999, Hans Reiser wrote:

> The wait_queue stuff has changed, and I find stuff like the field
> compiler_warning to be cryptic. There are no comments on the
> datastructures....
>
> Anybody know what has changed, and what the basic idea is behind the new
> stuff in 2.3.8?

there have been four major changes/goals wrt. the waitqueues changes:

1) waitqueue heads were separated from waitqueue entries, data-structure
wise. Formerly the head was a pointer, which was not generic enough, see
later.

2) the waitqueue list has been changed to be a double-linked never-zero
ringlist. This has obvious micro-speed and algorithmical scaling benefits,
formerly remove_from_wait_queue() had to potentially traverse all the
waitqueue to remove a single entry. Now it's all O(1).

3) the generic datastructures enabled us to add per-waitqueue spinlocks
which makes us scale better on SMP. Particularly __wake_up() tends to hold
the waitqueue lock while doing other stuff (well, waking up processes), so
this is a definit win. It was also easy and seemless due to the generic
data structures. The spinlock architecture is atm. 'dual', which means
that it can be switched between readwrite and 'simple' spinlocks via a
define. The 'simple' version was benchmarked to perform better, that one
will probably stick and the rw-version will be removed.

4) all these changes enabled to implement the primary goal that triggered
all these changes and cleanups: it was possible to add wake-one semantics
for wakeup() in a clean way. (see the TASK_EXCLUSIVE stuff)

compiler_warning is there to make old code generate more warning messages
when you old-style initialize waitqueues.

the debugging stuff will be removed before 2.4 - the frequency of
waitqueue-related bugs is already very low. There is still some small
benchmarking work to be done wrt. the wakeup order of exclusive tasks.

-- mingo

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