Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
wait.c File Reference
#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.

Functions

void __init_waitqueue_head (wait_queue_head_t *q, const char *name, struct lock_class_key *key)
 
 EXPORT_SYMBOL (__init_waitqueue_head)
 
void add_wait_queue (wait_queue_head_t *q, wait_queue_t *wait)
 
 EXPORT_SYMBOL (add_wait_queue)
 
void add_wait_queue_exclusive (wait_queue_head_t *q, wait_queue_t *wait)
 
 EXPORT_SYMBOL (add_wait_queue_exclusive)
 
void remove_wait_queue (wait_queue_head_t *q, wait_queue_t *wait)
 
 EXPORT_SYMBOL (remove_wait_queue)
 
void prepare_to_wait (wait_queue_head_t *q, wait_queue_t *wait, int state)
 
 EXPORT_SYMBOL (prepare_to_wait)
 
void prepare_to_wait_exclusive (wait_queue_head_t *q, wait_queue_t *wait, int state)
 
 EXPORT_SYMBOL (prepare_to_wait_exclusive)
 
void finish_wait (wait_queue_head_t *q, wait_queue_t *wait)
 
 EXPORT_SYMBOL (finish_wait)
 
void abort_exclusive_wait (wait_queue_head_t *q, wait_queue_t *wait, unsigned int mode, void *key)
 
 EXPORT_SYMBOL (abort_exclusive_wait)
 
int autoremove_wake_function (wait_queue_t *wait, unsigned mode, int sync, void *key)
 
 EXPORT_SYMBOL (autoremove_wake_function)
 
int wake_bit_function (wait_queue_t *wait, unsigned mode, int sync, void *arg)
 
 EXPORT_SYMBOL (wake_bit_function)
 
int __sched __wait_on_bit (wait_queue_head_t *wq, struct wait_bit_queue *q, int(*action)(void *), unsigned mode)
 
 EXPORT_SYMBOL (__wait_on_bit)
 
int __sched out_of_line_wait_on_bit (void *word, int bit, int(*action)(void *), unsigned mode)
 
 EXPORT_SYMBOL (out_of_line_wait_on_bit)
 
int __sched __wait_on_bit_lock (wait_queue_head_t *wq, struct wait_bit_queue *q, int(*action)(void *), unsigned mode)
 
 EXPORT_SYMBOL (__wait_on_bit_lock)
 
int __sched out_of_line_wait_on_bit_lock (void *word, int bit, int(*action)(void *), unsigned mode)
 
 EXPORT_SYMBOL (out_of_line_wait_on_bit_lock)
 
void __wake_up_bit (wait_queue_head_t *wq, void *word, int bit)
 
 EXPORT_SYMBOL (__wake_up_bit)
 
void wake_up_bit (void *word, int bit)
 
 EXPORT_SYMBOL (wake_up_bit)
 
wait_queue_head_tbit_waitqueue (void *word, int bit)
 
 EXPORT_SYMBOL (bit_waitqueue)
 

Function Documentation

void __init_waitqueue_head ( wait_queue_head_t q,
const char name,
struct lock_class_key key 
)

Definition at line 13 of file wait.c.

int __sched __wait_on_bit ( wait_queue_head_t wq,
struct wait_bit_queue q,
int(*)(void *)  action,
unsigned  mode 
)

Definition at line 194 of file wait.c.

int __sched __wait_on_bit_lock ( wait_queue_head_t wq,
struct wait_bit_queue q,
int(*)(void *)  action,
unsigned  mode 
)

Definition at line 220 of file wait.c.

void __wake_up_bit ( wait_queue_head_t wq,
void word,
int  bit 
)

Definition at line 250 of file wait.c.

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.

Definition at line 148 of file wait.c.

void add_wait_queue ( wait_queue_head_t q,
wait_queue_t wait 
)

Definition at line 22 of file wait.c.

void add_wait_queue_exclusive ( wait_queue_head_t q,
wait_queue_t wait 
)

Definition at line 33 of file wait.c.

int autoremove_wake_function ( wait_queue_t wait,
unsigned  mode,
int  sync,
void key 
)

Definition at line 163 of file wait.c.

wait_queue_head_t* bit_waitqueue ( void word,
int  bit 
)

Definition at line 281 of file wait.c.

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 
)

finish_wait - clean up after waiting in a queue : waitqueue waited on : wait descriptor

Sets current thread back to running state and removes the wait descriptor from the given waitqueue if still queued.

Definition at line 104 of file wait.c.

int __sched out_of_line_wait_on_bit ( void word,
int  bit,
int(*)(void *)  action,
unsigned  mode 
)

Definition at line 209 of file wait.c.

int __sched out_of_line_wait_on_bit_lock ( void word,
int  bit,
int(*)(void *)  action,
unsigned  mode 
)

Definition at line 240 of file wait.c.

void prepare_to_wait ( wait_queue_head_t q,
wait_queue_t wait,
int  state 
)

Definition at line 68 of file wait.c.

void prepare_to_wait_exclusive ( wait_queue_head_t q,
wait_queue_t wait,
int  state 
)

Definition at line 82 of file wait.c.

void remove_wait_queue ( wait_queue_head_t q,
wait_queue_t wait 
)

Definition at line 44 of file wait.c.

int wake_bit_function ( wait_queue_t wait,
unsigned  mode,
int  sync,
void arg 
)

Definition at line 173 of file wait.c.

void wake_up_bit ( void word,
int  bit 
)

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.

Definition at line 275 of file wait.c.