lkml.org 
[lkml]   [2013]   [Mar]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 14/31] workqueue: replace POOL_MANAGING_WORKERS flag with worker_pool->manager_mutex
Hello, Lai.

On Sun, Mar 10, 2013 at 06:09:38PM +0800, Lai Jiangshan wrote:
> > - if (pool->flags & POOL_MANAGING_WORKERS)
> > + if (!mutex_trylock(&pool->manager_mutex))
> > return ret;
> >
> > - pool->flags |= POOL_MANAGING_WORKERS;
>
>
> if mutex_trylock(&pool->manager_mutex) fails, it does not mean
> the pool is managing workers. (although current code does).
> so I recommend to keep POOL_MANAGING_WORKERS.

So, that's the intention. It's gonna be used during pool destruction
and we want all the workers to think that the pool is being managed
and it's safe to proceed.

> I suggest that you reuse assoc_mutex for your purpose(later patches).
> (and rename assoc_mutex back to manager_mutex)

They are different. assoc_mutex makes the workers wait for the
managership, which shouldn't happen during pool destruction. We want
the workers to assume that the pool is managed which is what
manager_mutex achieves.

Thanks.

--
tejun


\
 
 \ /
  Last update: 2013-03-10 14:41    [W:0.143 / U:0.480 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site