Re: [PATCH 0/6] workqueue: simpler&better workers management synchronization

From: Lai Jiangshan
Date: Sun Apr 20 2014 - 21:29:57 EST


On 04/12/2014 06:50 PM, Lai Jiangshan wrote:
> Sorry,
> the cover letter was forgotten to send to LKML.

Hi, Tejun

Any comments about the patchset.
(general comments, high level comments)

Thanks.
Lai

>
> On 04/12/2014 06:45 PM, Lai Jiangshan wrote:
>> Each patches remove codes!
>>
>> Patch1&2 are the basic patches. They add a *united* mechanism for managing
>> percpu pools' workers' & unbound pools' workers' & rescuers' CPUMASK.
>>
>> Patch1&4 make workers-concurrency-enabling atomically when cpu_online()
>> and create_worker(). after this, workers-concurrency-enabling-disabling
>> are all atomically.
>>
>> Old manager_mutex protects:
>> 1) workers creation&destruction
>> 2) workers cpumask managing when cpu_online()/workers-creation
>> 3) workers concurrency enabling&disabling.
>>
>> Now, the above three things' synchronization are separated.
>> 1) We don't need manager_mutex protects workers creation&destruction
>> 1.1) creation is only happened when the cpu is first online, the unbound pool
>> is just created, and manage_workers(). they have their one synchronization.
>> 1.2) destruction only happens on idle-timeout handler, protected by pool->lock.
>> 1.3) put_unbound_pool() uses manager_arb&workers_leave(new) to synchronize
>> with workers creation&destruction.
>>
>> 2) bind_mutex and bind_list handle all the workers'(percpu,unbound,
>> normal,rescuer) cpumask when cpu_online()/workers-creation/worker-destrution.
>> we don't need manager_mutex.
>>
>> 3) pool->lock and worker_idr handle workers concurrency enabling&disabling.
>>
>> Note, bind_list is always a super set of worker_idr, and when cpu-online or
>> workers-creation, cpumask is set at first and then concurrency-enabling.
>> concurrency-management depends on local-wakeup which depends on cpumask
>> is properly set for all the workers.
>>
>> This patchset depends on previous patch:
>> "workqueue: fix possible race condition when rescuer VS pwq-release"
>>
>> Thanks,
>> Lai
>>
>>
>> Lai Jiangshan (6):
>> workqueue: generic routine to restore percpu/unbound pools' workers'
>> cpumask
>> workqueue: generic framework to manage normal&rescuer workers'
>> cpumask
>> workqueue: make destroy_worker() atomically
>> workqueue: commit worker to pool's concurrency setting atomically.
>> workqueue: remove manager_mutex
>> workqueue: destroy worker directly in idle timeout handler
>>
>> kernel/workqueue.c | 366 ++++++++++++------------------------------
>> kernel/workqueue_internal.h | 1 +
>> 2 files changed, 106 insertions(+), 261 deletions(-)
>>
>
> .
>

--
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/