lkml.org 
[lkml]   [2014]   [May]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 03/10] workqueue: async worker destruction
On Sun, Apr 27, 2014 at 12:08:58PM +0800, Lai Jiangshan wrote:
> worker destruction includes these parts of code:
> adjust pool's stats
> remove the worker from idle list
> unbind the worker from the pool
> kthread_stop() to wait for the worker's task exit
> free the worker struct
>
> We can find out that there is no essential thing to do after
> kthread_stop(). Which means destroy_worker() doesn't need
> to wait for the worker's task exit. So we can remove kthread_stop()
> and free the worker struct in the worker exiting path.
>
> But put_unbound_pool() still needs to sync the all the workers'
> destruction before to destroy the pool. Otherwise the workers
> may access to the invalid pool when they are exiting.
>
> So we also move the code of "unbind the worker" to the exiting
> path and let put_unbound_pool() to sync with this code via
> a wait_queue_head_t workers_unbound.
>
> The code of "unbind the worker" is wrapped in a function "worker_unbind_pool()"
>
> Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
> ---
> kernel/workqueue.c | 44 ++++++++++++++++++++++++++++----------------
> 1 files changed, 28 insertions(+), 16 deletions(-)

Is this any simpler? Does this enable larger simplification down the
road?

Thanks.

--
tejun


\
 
 \ /
  Last update: 2014-05-05 21:21    [W:0.319 / U:0.356 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site