Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 316717
b: refs/heads/master
c: f2d5a0e
h: refs/heads/master
i:
  316715: bcb9e0f
v: v3
  • Loading branch information
Tejun Heo committed Jul 17, 2012
1 parent bb980c6 commit 7226903
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 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: 6575820221f7a4dd6eadecf7bf83cdd154335eda
refs/heads/master: f2d5a0ee06c1813f985bb9386f3ccc0d0315720f
29 changes: 13 additions & 16 deletions trunk/kernel/workqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -1250,11 +1250,11 @@ static void worker_leave_idle(struct worker *worker)
* verbatim as it's best effort and blocking and gcwq may be
* [dis]associated in the meantime.
*
* This function tries set_cpus_allowed() and locks gcwq and verifies
* the binding against GCWQ_DISASSOCIATED which is set during
* CPU_DYING and cleared during CPU_ONLINE, so if the worker enters
* idle state or fetches works without dropping lock, it can guarantee
* the scheduling requirement described in the first paragraph.
* This function tries set_cpus_allowed() and locks gcwq and verifies the
* binding against %GCWQ_DISASSOCIATED which is set during
* %CPU_DOWN_PREPARE and cleared during %CPU_ONLINE, so if the worker
* enters idle state or fetches works without dropping lock, it can
* guarantee the scheduling requirement described in the first paragraph.
*
* CONTEXT:
* Might sleep. Called without any lock but returns with gcwq->lock
Expand Down Expand Up @@ -3349,6 +3349,12 @@ static int __cpuinit trustee_thread(void *__gcwq)
rc = trustee_wait_event(!gcwq_is_managing_workers(gcwq));
BUG_ON(rc < 0);

/*
* We've claimed all manager positions. Make all workers unbound
* and set DISASSOCIATED. Before this, all workers except for the
* ones which are still executing works from before the last CPU
* down must be on the cpu. After this, they may become diasporas.
*/
for_each_worker_pool(pool, gcwq) {
pool->flags |= POOL_MANAGING_WORKERS;

Expand All @@ -3359,6 +3365,8 @@ static int __cpuinit trustee_thread(void *__gcwq)
for_each_busy_worker(worker, i, pos, gcwq)
worker->flags |= WORKER_ROGUE;

gcwq->flags |= GCWQ_DISASSOCIATED;

/*
* Call schedule() so that we cross rq->lock and thus can
* guarantee sched callbacks see the rogue flag. This is
Expand Down Expand Up @@ -3582,16 +3590,6 @@ static int __devinit workqueue_cpu_callback(struct notifier_block *nfb,
}
break;

case CPU_DYING:
/*
* Before this, the trustee and all workers except for
* the ones which are still executing works from
* before the last CPU down must be on the cpu. After
* this, they'll all be diasporas.
*/
gcwq->flags |= GCWQ_DISASSOCIATED;
break;

case CPU_POST_DEAD:
gcwq->trustee_state = TRUSTEE_BUTCHER;
/* fall through */
Expand Down Expand Up @@ -3672,7 +3670,6 @@ static int __devinit workqueue_cpu_down_callback(struct notifier_block *nfb,
{
switch (action & ~CPU_TASKS_FROZEN) {
case CPU_DOWN_PREPARE:
case CPU_DYING:
case CPU_POST_DEAD:
return workqueue_cpu_callback(nfb, action, hcpu);
}
Expand Down

0 comments on commit 7226903

Please sign in to comment.