diff options
author | Tejun Heo <tj@kernel.org> | 2010-06-29 10:07:12 +0200 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2010-06-29 10:07:12 +0200 |
commit | a0a1a5fd4fb15ec61117c759fe9f5c16c53d9e9c (patch) | |
tree | 6df8eddcaeff6cde892c8cae6bdfa7653805e144 /include/linux | |
parent | 1e19ffc63dbbaea7a7d1c63d99c38d3e5a4c7edf (diff) | |
download | linux-a0a1a5fd4fb15ec61117c759fe9f5c16c53d9e9c.tar.gz linux-a0a1a5fd4fb15ec61117c759fe9f5c16c53d9e9c.tar.bz2 linux-a0a1a5fd4fb15ec61117c759fe9f5c16c53d9e9c.zip |
workqueue: reimplement workqueue freeze using max_active
Currently, workqueue freezing is implemented by marking the worker
freezeable and calling try_to_freeze() from dispatch loop.
Reimplement it using cwq->limit so that the workqueue is frozen
instead of the worker.
* workqueue_struct->saved_max_active is added which stores the
specified max_active on initialization.
* On freeze, all cwq->max_active's are quenched to zero. Freezing is
complete when nr_active on all cwqs reach zero.
* On thaw, all cwq->max_active's are restored to wq->saved_max_active
and the worklist is repopulated.
This new implementation allows having single shared pool of workers
per cpu.
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/workqueue.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index eb753b7790e5..ab0b7fb99bc2 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h @@ -340,4 +340,11 @@ static inline long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg) #else long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg); #endif /* CONFIG_SMP */ + +#ifdef CONFIG_FREEZER +extern void freeze_workqueues_begin(void); +extern bool freeze_workqueues_busy(void); +extern void thaw_workqueues(void); +#endif /* CONFIG_FREEZER */ + #endif |