lkml.org 
[lkml]   [2012]   [Sep]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH -stable] workqueue: UNBOUND -> REBIND morphing in rebind_workers() should be atomic
From
Date
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]
\
 
 \ /
  Last update: 2012-09-16 18:21    [W:1.229 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site