[sheepdog] [PATCH v4 2/3] work: make locking by queue_work() more fine grain

Liu Yuan namei.unix at gmail.com
Wed Dec 18 07:25:48 CET 2013


On Wed, Dec 18, 2013 at 03:04:22PM +0900, Hitoshi Mitake wrote:
> wi->nr_threads is protected by wi->startup_lock now, we can make the
> critical section in queue_work() smaller.
> 
> Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
> ---
>  lib/work.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/work.c b/lib/work.c
> index 9d5c5a9..c3b568b 100644
> --- a/lib/work.c
> +++ b/lib/work.c
> @@ -271,12 +271,12 @@ void queue_work(struct work_queue *q, struct work *work)
>  	struct worker_info *wi = container_of(q, struct worker_info, q);
>  
>  	uatomic_inc(&wi->nr_workers);
> -	pthread_mutex_lock(&wi->pending_lock);
>  
>  	if (wq_need_grow(wi))

no need to protect 'wq_need_grow'? I think this patch is wrong because
we_need_grow should be protected by wi->pending_lock.

Thanks
Yuan



More information about the sheepdog mailing list