Linux Kernel
3.7.1
|
#include <linux/init.h>
#include <linux/export.h>
#include <linux/sched.h>
#include <linux/mm.h>
#include <linux/wait.h>
#include <linux/hash.h>
Go to the source code of this file.
void __init_waitqueue_head | ( | wait_queue_head_t * | q, |
const char * | name, | ||
struct lock_class_key * | key | ||
) |
int __sched __wait_on_bit | ( | wait_queue_head_t * | wq, |
struct wait_bit_queue * | q, | ||
int(*)(void *) | action, | ||
unsigned | mode | ||
) |
int __sched __wait_on_bit_lock | ( | wait_queue_head_t * | wq, |
struct wait_bit_queue * | q, | ||
int(*)(void *) | action, | ||
unsigned | mode | ||
) |
void __wake_up_bit | ( | wait_queue_head_t * | wq, |
void * | word, | ||
int | bit | ||
) |
void abort_exclusive_wait | ( | wait_queue_head_t * | q, |
wait_queue_t * | wait, | ||
unsigned int | mode, | ||
void * | key | ||
) |
abort_exclusive_wait - abort exclusive waiting in a queue : waitqueue waited on : wait descriptor : runstate of the waiter to be woken : key to identify a wait bit queue or NULL
Sets current thread back to running state and removes the wait descriptor from the given waitqueue if still queued.
Wakes up the next waiter if the caller is concurrently woken up through the queue.
This prevents waiter starvation where an exclusive waiter aborts and is woken up concurrently and no one wakes up the next waiter.
void add_wait_queue | ( | wait_queue_head_t * | q, |
wait_queue_t * | wait | ||
) |
void add_wait_queue_exclusive | ( | wait_queue_head_t * | q, |
wait_queue_t * | wait | ||
) |
int autoremove_wake_function | ( | wait_queue_t * | wait, |
unsigned | mode, | ||
int | sync, | ||
void * | key | ||
) |
wait_queue_head_t* bit_waitqueue | ( | void * | word, |
int | bit | ||
) |
EXPORT_SYMBOL | ( | __init_waitqueue_head | ) |
EXPORT_SYMBOL | ( | add_wait_queue | ) |
EXPORT_SYMBOL | ( | add_wait_queue_exclusive | ) |
EXPORT_SYMBOL | ( | remove_wait_queue | ) |
EXPORT_SYMBOL | ( | prepare_to_wait | ) |
EXPORT_SYMBOL | ( | prepare_to_wait_exclusive | ) |
EXPORT_SYMBOL | ( | finish_wait | ) |
EXPORT_SYMBOL | ( | abort_exclusive_wait | ) |
EXPORT_SYMBOL | ( | autoremove_wake_function | ) |
EXPORT_SYMBOL | ( | wake_bit_function | ) |
EXPORT_SYMBOL | ( | __wait_on_bit | ) |
EXPORT_SYMBOL | ( | out_of_line_wait_on_bit | ) |
EXPORT_SYMBOL | ( | __wait_on_bit_lock | ) |
EXPORT_SYMBOL | ( | out_of_line_wait_on_bit_lock | ) |
EXPORT_SYMBOL | ( | __wake_up_bit | ) |
EXPORT_SYMBOL | ( | wake_up_bit | ) |
EXPORT_SYMBOL | ( | bit_waitqueue | ) |
void finish_wait | ( | wait_queue_head_t * | q, |
wait_queue_t * | wait | ||
) |
void prepare_to_wait | ( | wait_queue_head_t * | q, |
wait_queue_t * | wait, | ||
int | state | ||
) |
void prepare_to_wait_exclusive | ( | wait_queue_head_t * | q, |
wait_queue_t * | wait, | ||
int | state | ||
) |
void remove_wait_queue | ( | wait_queue_head_t * | q, |
wait_queue_t * | wait | ||
) |
int wake_bit_function | ( | wait_queue_t * | wait, |
unsigned | mode, | ||
int | sync, | ||
void * | arg | ||
) |
wake_up_bit - wake up a waiter on a bit : the word being waited on, a kernel virtual address : the bit of the word being waited on
There is a standard hashed waitqueue table for generic use. This is the part of the hashtable's accessor API that wakes up waiters on a bit. For instance, if one were to have waiters on a bitflag, one would call wake_up_bit() after clearing the bit.
In order for this to function properly, as it uses waitqueue_active() internally, some kind of memory barrier must be done prior to calling this. Typically, this will be smp_mb__after_clear_bit(), but in some cases where bitflags are manipulated non-atomically under a lock, one may need to use a less regular barrier, such fs/inode.c's smp_mb(), because spin_unlock() does not guarantee a memory barrier.