Messages in this thread | | | Subject | Re: [PATCH -stable] workqueue: UNBOUND -> REBIND morphing in rebind_workers() should be atomic | From | Ben Hutchings <> | Date | Sun, 16 Sep 2012 16:49:47 +0100 |
| |
On Tue, 2012-09-04 at 16:58 -0700, Tejun Heo wrote: > From: Lai Jiangshan <laijs@cn.fujitsu.com> > > The compiler may compile the following code into TWO write/modify > instructions. > > worker->flags &= ~WORKER_UNBOUND; > worker->flags |= WORKER_REBIND; > > so the other CPU may temporarily see worker->flags which doesn't have > either WORKER_UNBOUND or WORKER_REBIND set and perform local wakeup > prematurely. > > Fix it by using single explicit assignment via ACCESS_ONCE(). > > Because idle workers have another WORKER_NOT_RUNNING flag, this bug > doesn't exist for them; however, update it to use the same pattern for > consistency. > > tj: Applied the change to idle workers too and updated comments and > patch description a bit. > > stable: Idle worker rebinding doesn't apply for -stable and > WORKER_UNBOUND used to be WORKER_ROGUE. Updated accordingly. [...]
Added to the queue for 3.2, thanks.
Ben.
-- Ben Hutchings Experience is what causes a person to make new mistakes instead of old ones. [unhandled content-type:application/pgp-signature] | |