> I was reading through the new edition of Linux Device Drivers and
> decided to try the TASK_EXCLUSIVE flag to get a single member of a
> wait queue to wake. I get a compile error though that it is
> undeclared. Grepping the kernel source came up with nothing.
the 2.4 waitqueue interface has changed as part of the wake-some semantics
introduced for the block-IO-scheduler changes. Wake-some is more generic
than wake-one. The new way to add a wake-some task to a waitqueue is to
use the add_wait_queue_exclusive() function. To add a 'wake-all' task you
should use the well-known add_wait_queue() function.
TASK_EXCLUSIVE was an interim implementation that supported wake-one only.
The new implementation enables a task to be on multiple waitqueues with
different wake-up semantics, because there is now a per-waitqueue-entry
attribute, not a per-task (and thus global) attribute for wake-some
semantics.
When a wake_up_nr(N) wakeup event comes, all wake-all tasks will be woken
up, and 'N' wake-some tasks. The 'old' wake_up() function is
wake_up_nr(1). Wake-one is a special case of wake-some, where N = 1. There
is also a new wake_up_all() function that wakes up all tasks disregarding
their wake-up attribute, including all wake-some tasks.
current usage of these interfaces: most places in the kernel use wake_up()
and use wake-all tasks - like they did for years. 'Old' code that does not
need to optimize waitqueue behavior behaves in the expected way.
Networking, the semaphore code, the pagecache locking code and some other
places uses wake-one waitqueues. Certain parts of networking use a mixed
waitqueue with wake-some and wake-all tasks. The block IO scheduler uses
wake-some to signal the completion of multiple IO slots. wake_up_all() is
used in a couple of places as well, like TUX [ :-) ], to eg. deregister
all wake-one worker threads with a single call.
Ingo
-
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/