aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/workqueue.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/workqueue.c')
-rw-r--r--kernel/workqueue.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 3e324aae3c9..b5d722548ff 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -3367,6 +3367,26 @@ void destroy_workqueue(struct workqueue_struct *wq)
3367EXPORT_SYMBOL_GPL(destroy_workqueue); 3367EXPORT_SYMBOL_GPL(destroy_workqueue);
3368 3368
3369/** 3369/**
3370 * cwq_set_max_active - adjust max_active of a cwq
3371 * @cwq: target cpu_workqueue_struct
3372 * @max_active: new max_active value.
3373 *
3374 * Set @cwq->max_active to @max_active and activate delayed works if
3375 * increased.
3376 *
3377 * CONTEXT:
3378 * spin_lock_irq(gcwq->lock).
3379 */
3380static void cwq_set_max_active(struct cpu_workqueue_struct *cwq, int max_active)
3381{
3382 cwq->max_active = max_active;
3383
3384 while (!list_empty(&cwq->delayed_works) &&
3385 cwq->nr_active < cwq->max_active)
3386 cwq_activate_first_delayed(cwq);
3387}
3388
3389/**
3370 * workqueue_set_max_active - adjust max_active of a workqueue 3390 * workqueue_set_max_active - adjust max_active of a workqueue
3371 * @wq: target workqueue 3391 * @wq: target workqueue
3372 * @max_active: new max_active value. 3392 * @max_active: new max_active value.
@@ -3792,11 +3812,7 @@ void thaw_workqueues(void)
3792 continue; 3812 continue;
3793 3813
3794 /* restore max_active and repopulate worklist */ 3814 /* restore max_active and repopulate worklist */
3795 cwq->max_active = wq->saved_max_active; 3815 cwq_set_max_active(cwq, wq->saved_max_active);
3796
3797 while (!list_empty(&cwq->delayed_works) &&
3798 cwq->nr_active < cwq->max_active)
3799 cwq_activate_first_delayed(cwq);
3800 } 3816 }
3801 3817
3802 for_each_worker_pool(pool, gcwq) 3818 for_each_worker_pool(pool, gcwq)