Skip to content

Commit

Permalink
Merge branch 'for-3.6-fixes' of git://git.kernel.org/pub/scm/linux/ke…
Browse files Browse the repository at this point in the history
…rnel/git/tj/wq

Pull another workqueue fix from Tejun Heo:
 "Unfortunately, yet another late fix.  This too is discovered and fixed
  by Lai.  This bug was introduced during this merge window by commit
  25511a4 ("workqueue: reimplement CPU online rebinding to handle
  idle workers") which started using WORKER_REBIND flag for idle rebind
  too.

  The bug is relatively easy to trigger if the CPU rapidly goes through
  off, on and then off (and stay off).  The fix is on the safer side.
  This hasn't been on linux-next yet but I'm pushing early so that it
  can get more exposure before v3.6 release."

* 'for-3.6-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq:
  workqueue: always clear WORKER_REBIND in busy_worker_rebind_fn()
  • Loading branch information
Linus Torvalds committed Sep 17, 2012
2 parents 08077ca + 960bd11 commit 4651afb
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions kernel/workqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -1349,8 +1349,16 @@ static void busy_worker_rebind_fn(struct work_struct *work)
struct worker *worker = container_of(work, struct worker, rebind_work);
struct global_cwq *gcwq = worker->pool->gcwq;

if (worker_maybe_bind_and_lock(worker))
worker_clr_flags(worker, WORKER_REBIND);
worker_maybe_bind_and_lock(worker);

/*
* %WORKER_REBIND must be cleared even if the above binding failed;
* otherwise, we may confuse the next CPU_UP cycle or oops / get
* stuck by calling idle_worker_rebind() prematurely. If CPU went
* down again inbetween, %WORKER_UNBOUND would be set, so clearing
* %WORKER_REBIND is always safe.
*/
worker_clr_flags(worker, WORKER_REBIND);

spin_unlock_irq(&gcwq->lock);
}
Expand Down

0 comments on commit 4651afb

Please sign in to comment.