[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5371C1DC.8030102@cn.fujitsu.com>
Date: Tue, 13 May 2014 14:55:24 +0800
From: Lai Jiangshan <laijs@...fujitsu.com>
To: Tejun Heo <tj@...nel.org>
CC: <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 10/10 V2] workqueue: use generic attach/detach routine
for rescuers
On 05/13/2014 06:05 AM, Tejun Heo wrote:
> On Mon, May 12, 2014 at 02:56:22PM +0800, Lai Jiangshan wrote:
>> There are several problems with the code that rescuers bind itself to the pool'
>> cpumask
>> 1) It uses a way different from the normal workers to bind to the cpumask
>> So we can't maintain the normal/rescuer workers under the same framework.
>> 2) The the code of cpu-binding for rescuer is complicated
>> 3) If one or more cpuhotplugs happen while the rescuer processes the
>> scheduled works, the rescuer may not be correctly bound to the cpumask of
>> the pool. This is allowed behavior, but is not good. It will be better
>> if the cpumask of the rescuer is always kept coordination with the pool
>> across any cpuhotplugs.
>>
>> Using generic attach/detach routine will solve the above problems,
>> and result much more simple code.
>>
>> Signed-off-by: Lai Jiangshan <laijs@...fujitsu.com>
>> static struct worker *alloc_worker(void)
>> {
>> struct worker *worker;
>> @@ -2343,8 +2279,9 @@ repeat:
>>
>> spin_unlock_irq(&wq_mayday_lock);
>>
>> - /* migrate to the target cpu if possible */
>> - worker_maybe_bind_and_lock(pool);
>> + worker_attach_to_pool(rescuer, pool);
>> +
>> + spin_lock_irq(&pool->lock);
>> rescuer->pool = pool;
>>
>> /*
>> @@ -2357,6 +2294,11 @@ repeat:
>> move_linked_works(work, scheduled, &n);
>>
>> process_scheduled_works(rescuer);
>> + spin_unlock_irq(&pool->lock);
>> +
>> + worker_detach_from_pool(rescuer, pool);
>> +
>> + spin_lock_irq(&pool->lock);
>
> Ah, right, this is how it's used. Yeah, it makes sense. In a long
> patchset, it usually helps to mention your intentions when structuring
> functions tho. When you're separating out detach_from_pool, just
> mention that the function will later be used to make rescuers use the
In patch3, the intention for separating out detach_from_pool() is
only for aync-destruction and it is used for worker_thread().
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists