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>
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user