Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 350286
b: refs/heads/master
c: a105630
h: refs/heads/master
v: v3
  • Loading branch information
Tejun Heo committed Jan 24, 2013
1 parent 7d75376 commit ee3ea2e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 27 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 94cf58bb2907bd2702fce2266955e29ab5261f53
refs/heads/master: a1056305fa98c7e13b38718658a8b07a5d926460
46 changes: 20 additions & 26 deletions trunk/kernel/workqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -3686,25 +3686,22 @@ void freeze_workqueues_begin(void)
struct worker_pool *pool;
struct workqueue_struct *wq;

local_irq_disable();

for_each_worker_pool(pool, gcwq) {
spin_lock_nested(&pool->lock, pool - gcwq->pools);
spin_lock_irq(&pool->lock);

WARN_ON_ONCE(pool->flags & POOL_FREEZING);
pool->flags |= POOL_FREEZING;
}

list_for_each_entry(wq, &workqueues, list) {
struct cpu_workqueue_struct *cwq = get_cwq(cpu, wq);
list_for_each_entry(wq, &workqueues, list) {
struct cpu_workqueue_struct *cwq = get_cwq(cpu, wq);

if (cwq && wq->flags & WQ_FREEZABLE)
cwq->max_active = 0;
}
if (cwq && cwq->pool == pool &&
(wq->flags & WQ_FREEZABLE))
cwq->max_active = 0;
}

for_each_worker_pool(pool, gcwq)
spin_unlock(&pool->lock);
local_irq_enable();
spin_unlock_irq(&pool->lock);
}
}

spin_unlock(&workqueue_lock);
Expand Down Expand Up @@ -3779,30 +3776,27 @@ void thaw_workqueues(void)
struct worker_pool *pool;
struct workqueue_struct *wq;

local_irq_disable();

for_each_worker_pool(pool, gcwq) {
spin_lock_nested(&pool->lock, pool - gcwq->pools);
spin_lock_irq(&pool->lock);

WARN_ON_ONCE(!(pool->flags & POOL_FREEZING));
pool->flags &= ~POOL_FREEZING;
}

list_for_each_entry(wq, &workqueues, list) {
struct cpu_workqueue_struct *cwq = get_cwq(cpu, wq);
list_for_each_entry(wq, &workqueues, list) {
struct cpu_workqueue_struct *cwq = get_cwq(cpu, wq);

if (!cwq || !(wq->flags & WQ_FREEZABLE))
continue;
if (!cwq || cwq->pool != pool ||
!(wq->flags & WQ_FREEZABLE))
continue;

/* restore max_active and repopulate worklist */
cwq_set_max_active(cwq, wq->saved_max_active);
}
/* restore max_active and repopulate worklist */
cwq_set_max_active(cwq, wq->saved_max_active);
}

for_each_worker_pool(pool, gcwq) {
wake_up_worker(pool);
spin_unlock(&pool->lock);

spin_unlock_irq(&pool->lock);
}
local_irq_enable();
}

workqueue_freezing = false;
Expand Down

0 comments on commit ee3ea2e

Please sign in to comment.