/* * linux/kernel/workqueue.c * * Generic mechanism for defining kernel helper threads for running * arbitrary tasks in process context. * * Started by Ingo Molnar, Copyright (C) 2002 * * Derived from the taskqueue/keventd code by: * * David Woodhouse <dwmw2@infradead.org> * Andrew Morton * Kai Petzke <wpp@marie.physik.tu-berlin.de> * Theodore Ts'o <tytso@mit.edu> * * Made to use alloc_percpu by Christoph Lameter. */#include<linux/module.h>#include<linux/kernel.h>#include<linux/sched.h>#include<linux/init.h>#include<linux/signal.h>#include<linux/completion.h>#include<linux/workqueue.h>#include<linux/slab.h>#include<linux/cpu.h>#include<linux/notifier.h>#include<linux/kthread.h>#include<linux/hardirq.h>#include<linux/mempolicy.h>#include<linux/freezer.h>#include<linux/kallsyms.h>#include<linux/debug_locks.h>#include<linux/lockdep.h>/* * Structure fields follow one of the following exclusion rules. * * I: Set during initialization and read-only afterwards. * * L: cwq->lock protected. Access with cwq->lock held. * * F: wq->flush_mutex protected. * * W: workqueue_lock protected. *//* * The per-CPU workqueue (if single thread, we always use the first * possible cpu). The lower WORK_STRUCT_FLAG_BITS of * work_struct->data are used for flags and thus cwqs need to be * aligned at two's power of the number of flag bits. */structcpu_workqueue_struct{spinlock_tlock;structlist_headworklist;wait_queue_head_tmore_work;structwork_struct*current_work;unsignedintcpu;structworkqueue_struct*wq; <