Re: [PATCH 03/11 V5] workqueue: new day don't need WORKER_REBINDfor busy rebinding

From: Lai Jiangshan
Date: Wed Sep 05 2012 - 22:08:51 EST


On 09/06/2012 02:31 AM, Tejun Heo wrote:
> On Wed, Sep 05, 2012 at 06:37:40PM +0800, Lai Jiangshan wrote:
>> because old busy_worker_rebind_fn() have to wait until all idle worker finish.
>> so we have to use two flags WORKER_UNBOUND and WORKER_REBIND to avoid
>> prematurely clear all NOT_RUNNING bit when highly frequent offline/online.
>>
>> but current code don't need to wait idle workers. so we don't need to
>> use two flags, just one is enough. remove WORKER_REBIND from busy rebinding.
>
> ROGUE / REBIND thing existed for busy workers from the beginning when
> there was no idle worker rebinding, so this definitely wasn't about
> whether idle rebind is synchronous or not.

In very old day, this definitely wasn't about whether idle rebind is synchronous or not.
but after you reimplement rebind_worker(), it is the only reason for WORKER_REBIND in busy rebinding.

if I miss something, this 03/11 will be wrong. the old code did not comment all why
WORKER_REBIND is needed. so we have to think more about the correctness of this 03/11.

> Trying to remember
> what... ah, okay, setting of DISASSOCIATED and setting of WORKER_ROGUE
> didn't use to happen together with gcwq->lock held. CPU_DOWN would
> first set ROGUE and then later on set DISASSOCIATED, so if the
> rebind_fn kicks in inbetween that, it would break CPU_DOWN.
>
> I think now that both CPU_DOWN and UP are done under single holding of
> gcwq->lock, this should be safe. It would be nice to note what
> changed in the patch description and the atomicity requirement as a
> comment tho.
>

Oh, I forgot to add changelog about single holding of gcwq->lock.


Thanks
Lai

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/