workqueue.c File Reference

Go to the source code of this file.

Classes

struct  cpu_workqueue_struct
struct  workqueue_struct
struct  wq_barrier

Functions

static DEFINE_SPINLOCK (workqueue_lock)
static LIST_HEAD (workqueues)
static int is_wq_single_threaded (struct workqueue_struct *wq)
static struct cpumask * wq_cpu_map (struct workqueue_struct *wq)
static struct
cpu_workqueue_struct
wq_per_cpu (struct workqueue_struct *wq, int cpu)
static void set_wq_data (struct work_struct *work, struct cpu_workqueue_struct *cwq)
static struct
cpu_workqueue_struct
get_wq_data (struct work_struct *work)
static void insert_work (struct cpu_workqueue_struct *cwq, struct work_struct *work, struct list_head *head)
static void __queue_work (struct cpu_workqueue_struct *cwq, struct work_struct *work)
int queue_work (struct workqueue_struct *wq, struct work_struct *work)
 queue_work - queue work on a workqueue : workqueue to use : work to queue
 EXPORT_SYMBOL_GPL (queue_work)
int queue_work_on (int cpu, struct workqueue_struct *wq, struct work_struct *work)
 queue_work_on - queue work on specific cpu : CPU number to execute work on : workqueue to use : work to queue
 EXPORT_SYMBOL_GPL (queue_work_on)
static void delayed_work_timer_fn (unsigned long __data)
int queue_delayed_work (struct workqueue_struct *wq, struct delayed_work *dwork, unsigned long delay)
 queue_delayed_work - queue work on a workqueue after delay : workqueue to use : delayable work to queue : number of jiffies to wait before queueing
 EXPORT_SYMBOL_GPL (queue_delayed_work)
int queue_delayed_work_on (int cpu, struct workqueue_struct *wq, struct delayed_work *dwork, unsigned long delay)
 queue_delayed_work_on - queue work on specific CPU after delay : CPU number to execute work on : workqueue to use : work to queue : number of jiffies to wait before queueing
 EXPORT_SYMBOL_GPL (queue_delayed_work_on)
static void run_workqueue (struct cpu_workqueue_struct *cwq)
static int worker_thread (void *__cwq)
static void wq_barrier_func (struct work_struct *work)
static void insert_wq_barrier (struct cpu_workqueue_struct *cwq, struct wq_barrier *barr, struct list_head *head)
static int flush_cpu_workqueue (struct cpu_workqueue_struct *cwq)
void flush_workqueue (struct workqueue_struct *wq)
 flush_workqueue - ensure that any scheduled work has run to completion.
 EXPORT_SYMBOL_GPL (flush_workqueue)
int flush_work (struct work_struct *work)
 flush_work - block until a work_struct's callback has terminated : the work which is to be flushed
 EXPORT_SYMBOL_GPL (flush_work)
static int try_to_grab_pending (struct work_struct *work)
static void wait_on_cpu_work (struct cpu_workqueue_struct *cwq, struct work_struct *work)
static void wait_on_work (struct work_struct *work)
static int __cancel_work_timer (struct work_struct *work, struct timer_list *timer)
int cancel_work_sync (struct work_struct *work)
 cancel_work_sync - block until a work_struct's callback has terminated : the work which is to be flushed
 EXPORT_SYMBOL_GPL (cancel_work_sync)
int cancel_delayed_work_sync (struct delayed_work *dwork)
 cancel_delayed_work_sync - reliably kill off a delayed work.
 EXPORT_SYMBOL (cancel_delayed_work_sync)
int schedule_work (struct work_struct *work)
 schedule_work - put work task in global workqueue : job to be done
 EXPORT_SYMBOL (schedule_work)
int schedule_work_on (int cpu, struct work_struct *work)
 EXPORT_SYMBOL (schedule_work_on)
int schedule_delayed_work (struct delayed_work *dwork, unsigned long delay)
 schedule_delayed_work - put work task in global workqueue after delay : job to be done : number of jiffies to wait or 0 for immediate execution
 EXPORT_SYMBOL (schedule_delayed_work)
int schedule_delayed_work_on (int cpu, struct delayed_work *dwork, unsigned long delay)
 schedule_delayed_work_on - queue work in global workqueue on CPU after delay : cpu to use : job to be done : number of jiffies to wait
 EXPORT_SYMBOL (schedule_delayed_work_on)
int schedule_on_each_cpu (work_func_t func)
 schedule_on_each_cpu - call a function on each online CPU from keventd : the function to call
void flush_scheduled_work (void)
 EXPORT_SYMBOL (flush_scheduled_work)
int execute_in_process_context (work_func_t fn, struct execute_work *ew)
 EXPORT_SYMBOL_GPL (execute_in_process_context)
int keventd_up (void)
int current_is_keventd (void)
static struct
cpu_workqueue_struct
init_cpu_workqueue (struct workqueue_struct *wq, int cpu)
static int create_workqueue_thread (struct cpu_workqueue_struct *cwq, int cpu)
static void start_workqueue_thread (struct cpu_workqueue_struct *cwq, int cpu)
struct workqueue_struct__create_workqueue_key (const char *name, int singlethread, int freezeable, int rt, struct lock_class_key *key, const char *lock_name)
 EXPORT_SYMBOL_GPL (__create_workqueue_key)
static void cleanup_workqueue_thread (struct cpu_workqueue_struct *cwq)
void destroy_workqueue (struct workqueue_struct *wq)
 destroy_workqueue - safely terminate a workqueue : target workqueue
 EXPORT_SYMBOL_GPL (destroy_workqueue)
static int __devinit workqueue_cpu_callback (struct notifier_block *nfb, unsigned long action, void *hcpu)
void __init init_workqueues (void)

Variables

struct cpu_workqueue_struct ____cacheline_aligned
static int singlethread_cpu __read_mostly


Function Documentation

static int __cancel_work_timer ( struct work_struct *  work,
struct timer_list timer 
) [static]

Definition at line 560 of file workqueue.c.

struct workqueue_struct* __create_workqueue_key ( const char *  name,
int  singlethread,
int  freezeable,
int  rt,
struct lock_class_key *  key,
const char *  lock_name 
) [read]

Definition at line 810 of file workqueue.c.

static void __queue_work ( struct cpu_workqueue_struct cwq,
struct work_struct *  work 
) [static]

Definition at line 145 of file workqueue.c.

int cancel_delayed_work_sync ( struct delayed_work *  dwork  ) 

cancel_delayed_work_sync - reliably kill off a delayed work.

: the delayed work struct

Returns true if was pending.

It is possible to use this function if rearms itself via queue_work() or queue_delayed_work(). See also the comment for cancel_work_sync().

Definition at line 612 of file workqueue.c.

int cancel_work_sync ( struct work_struct *  work  ) 

cancel_work_sync - block until a work_struct's callback has terminated : the work which is to be flushed

Returns true if was pending.

cancel_work_sync() will cancel the work if it is queued. If the work's callback appears to be running, cancel_work_sync() will block until it has completed.

It is possible to use this function if the work re-queues itself. It can cancel the work even if it migrates to another workqueue, however in that case it only guarantees that work->func() has completed on the last queued workqueue.

cancel_work_sync(&delayed_work->work) should be used only if ->timer is not pending, otherwise it goes into a busy-wait loop until the timer expires.

The caller must ensure that workqueue_struct on which this work was last queued can't be destroyed before this function returns.

Definition at line 597 of file workqueue.c.

static void cleanup_workqueue_thread ( struct cpu_workqueue_struct cwq  )  [static]

Definition at line 877 of file workqueue.c.

static int create_workqueue_thread ( struct cpu_workqueue_struct cwq,
int  cpu 
) [static]

Definition at line 774 of file workqueue.c.

int current_is_keventd ( void   ) 

Definition at line 745 of file workqueue.c.

static DEFINE_SPINLOCK ( workqueue_lock   )  [static]

static void delayed_work_timer_fn ( unsigned long  __data  )  [static]

Definition at line 201 of file workqueue.c.

void destroy_workqueue ( struct workqueue_struct wq  ) 

destroy_workqueue - safely terminate a workqueue : target workqueue

Safely destroy a workqueue. All work currently pending will be done first.

Definition at line 910 of file workqueue.c.

int execute_in_process_context ( work_func_t  fn,
struct execute_work *  ew 
)

Definition at line 726 of file workqueue.c.

EXPORT_SYMBOL ( flush_scheduled_work   ) 

EXPORT_SYMBOL ( schedule_delayed_work_on   ) 

EXPORT_SYMBOL ( schedule_delayed_work   ) 

EXPORT_SYMBOL ( schedule_work_on   ) 

EXPORT_SYMBOL ( schedule_work   ) 

EXPORT_SYMBOL ( cancel_delayed_work_sync   ) 

EXPORT_SYMBOL_GPL ( destroy_workqueue   ) 

EXPORT_SYMBOL_GPL ( __create_workqueue_key   ) 

EXPORT_SYMBOL_GPL ( execute_in_process_context   ) 

EXPORT_SYMBOL_GPL ( cancel_work_sync   ) 

EXPORT_SYMBOL_GPL ( flush_work   ) 

EXPORT_SYMBOL_GPL ( flush_workqueue   ) 

EXPORT_SYMBOL_GPL ( queue_delayed_work_on   ) 

EXPORT_SYMBOL_GPL ( queue_delayed_work   ) 

EXPORT_SYMBOL_GPL ( queue_work_on   ) 

EXPORT_SYMBOL_GPL ( queue_work   ) 

static int flush_cpu_workqueue ( struct cpu_workqueue_struct cwq  )  [static]

Definition at line 375 of file workqueue.c.

void flush_scheduled_work ( void   ) 

Definition at line 708 of file workqueue.c.

int flush_work ( struct work_struct *  work  ) 

flush_work - block until a work_struct's callback has terminated : the work which is to be flushed

Returns false if has already terminated.

It is expected that, prior to calling flush_work(), the caller has arranged for the work to not be requeued, otherwise it doesn't make sense to use this function.

Definition at line 440 of file workqueue.c.

void flush_workqueue ( struct workqueue_struct wq  ) 

flush_workqueue - ensure that any scheduled work has run to completion.

: workqueue to flush

Forces execution of the workqueue and blocks until its completion. This is typically used in driver shutdown handlers.

We sleep until all works which were queued on entry have been handled, but we are not livelocked by new incoming ones.

This function used to run the workqueues itself. Now we just wait for the helper threads to do it.

Definition at line 417 of file workqueue.c.

static struct cpu_workqueue_struct* get_wq_data ( struct work_struct *  work  )  [static, read]

Definition at line 127 of file workqueue.c.

static struct cpu_workqueue_struct* init_cpu_workqueue ( struct workqueue_struct wq,
int  cpu 
) [static, read]

Definition at line 762 of file workqueue.c.

void __init init_workqueues ( void   ) 

Definition at line 1020 of file workqueue.c.

static void insert_work ( struct cpu_workqueue_struct cwq,
struct work_struct *  work,
struct list_head *  head 
) [static]

Definition at line 132 of file workqueue.c.

static void insert_wq_barrier ( struct cpu_workqueue_struct cwq,
struct wq_barrier barr,
struct list_head *  head 
) [static]

Definition at line 364 of file workqueue.c.

static int is_wq_single_threaded ( struct workqueue_struct wq  )  [inline, static]

Definition at line 91 of file workqueue.c.

int keventd_up ( void   ) 

Definition at line 740 of file workqueue.c.

static LIST_HEAD ( workqueues   )  [static]

int queue_delayed_work ( struct workqueue_struct wq,
struct delayed_work *  dwork,
unsigned long  delay 
)

queue_delayed_work - queue work on a workqueue after delay : workqueue to use : delayable work to queue : number of jiffies to wait before queueing

Returns 0 if was already on a queue, non-zero otherwise.

Definition at line 218 of file workqueue.c.

int queue_delayed_work_on ( int  cpu,
struct workqueue_struct wq,
struct delayed_work *  dwork,
unsigned long  delay 
)

queue_delayed_work_on - queue work on specific CPU after delay : CPU number to execute work on : workqueue to use : work to queue : number of jiffies to wait before queueing

Returns 0 if was already on a queue, non-zero otherwise.

Definition at line 237 of file workqueue.c.

int queue_work ( struct workqueue_struct wq,
struct work_struct *  work 
)

queue_work - queue work on a workqueue : workqueue to use : work to queue

Returns 0 if was already on a queue, non-zero otherwise.

We queue the work to the CPU on which it was submitted, but if the CPU dies it can be processed by another CPU.

Definition at line 165 of file workqueue.c.

int queue_work_on ( int  cpu,
struct workqueue_struct wq,
struct work_struct *  work 
)

queue_work_on - queue work on specific cpu : CPU number to execute work on : workqueue to use : work to queue

Returns 0 if was already on a queue, non-zero otherwise.

We queue the work to a specific CPU, the caller must ensure it can't go away.

Definition at line 188 of file workqueue.c.

static void run_workqueue ( struct cpu_workqueue_struct cwq  )  [static]

Definition at line 266 of file workqueue.c.

int schedule_delayed_work ( struct delayed_work *  dwork,
unsigned long  delay 
)

schedule_delayed_work - put work task in global workqueue after delay : job to be done : number of jiffies to wait or 0 for immediate execution

After waiting for a given time this puts a job in the kernel-global workqueue.

Definition at line 653 of file workqueue.c.

int schedule_delayed_work_on ( int  cpu,
struct delayed_work *  dwork,
unsigned long  delay 
)

schedule_delayed_work_on - queue work in global workqueue on CPU after delay : cpu to use : job to be done : number of jiffies to wait

After waiting for a given time this puts a job in the kernel-global workqueue on the specified CPU.

Definition at line 669 of file workqueue.c.

int schedule_on_each_cpu ( work_func_t  func  ) 

schedule_on_each_cpu - call a function on each online CPU from keventd : the function to call

Returns zero on success. Returns -ve errno on failure.

schedule_on_each_cpu() is very slow.

Definition at line 685 of file workqueue.c.

int schedule_work ( struct work_struct *  work  ) 

schedule_work - put work task in global workqueue : job to be done

This puts a job in the kernel-global workqueue.

Definition at line 626 of file workqueue.c.

int schedule_work_on ( int  cpu,
struct work_struct *  work 
)

Definition at line 639 of file workqueue.c.

static void set_wq_data ( struct work_struct *  work,
struct cpu_workqueue_struct cwq 
) [inline, static]

Definition at line 114 of file workqueue.c.

static void start_workqueue_thread ( struct cpu_workqueue_struct cwq,
int  cpu 
) [static]

Definition at line 799 of file workqueue.c.

static int try_to_grab_pending ( struct work_struct *  work  )  [static]

Definition at line 485 of file workqueue.c.

static void wait_on_cpu_work ( struct cpu_workqueue_struct cwq,
struct work_struct *  work 
) [static]

Definition at line 520 of file workqueue.c.

static void wait_on_work ( struct work_struct *  work  )  [static]

Definition at line 537 of file workqueue.c.

static int worker_thread ( void *  __cwq  )  [static]

Definition at line 324 of file workqueue.c.

static int __devinit workqueue_cpu_callback ( struct notifier_block *  nfb,
unsigned long  action,
void *  hcpu 
) [static]

Definition at line 929 of file workqueue.c.

static void wq_barrier_func ( struct work_struct *  work  )  [static]

Definition at line 358 of file workqueue.c.

static struct cpumask* wq_cpu_map ( struct workqueue_struct wq  )  [static, read]

Definition at line 96 of file workqueue.c.

static struct cpu_workqueue_struct* wq_per_cpu ( struct workqueue_struct wq,
int  cpu 
) [static, read]

Definition at line 103 of file workqueue.c.


Variable Documentation

static struct workqueue_struct *keventd_wq __read_mostly [static, read]

Definition at line 79 of file workqueue.c.


Generated on Wed Apr 11 06:39:16 2012 for DDE - The L4 Device Driver Environment by  doxygen 1.5.6