From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754826AbdJIOrH (ORCPT ); Mon, 9 Oct 2017 10:47:07 -0400 Received: from mail-qk0-f195.google.com ([209.85.220.195]:34045 "EHLO mail-qk0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754775AbdJIOrG (ORCPT ); Mon, 9 Oct 2017 10:47:06 -0400 X-Google-Smtp-Source: AOwi7QCuLEnXlS3y0T/QZTeYQjmnaT8anjYsxVx3TYvuvcQjgsziDoi7GeEz2yrJltG1b0eSn/m0XQ== Date: Mon, 9 Oct 2017 07:47:02 -0700 From: Tejun Heo To: Boqun Feng Cc: linux-kernel@vger.kernel.org, Josef Bacik , Peter Zijlstra , Lai Jiangshan Subject: Re: [PATCH workqueue/for-4.14-fixes] workqueue: replace pool->manager_arb mutex with a flag Message-ID: <20171009144702.GB3301751@devbig577.frc2.facebook.com> References: <20171008090225.27034-1-boqun.feng@gmail.com> <20171009132104.GZ3301751@devbig577.frc2.facebook.com> <20171009142117.trbabd6m656ljf7w@tardis> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171009142117.trbabd6m656ljf7w@tardis> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, Boqun. On Mon, Oct 09, 2017 at 10:21:17PM +0800, Boqun Feng wrote: > > +static DECLARE_WAIT_QUEUE_HEAD(wq_manager_wait); /* wait for manager to go away */ > > I think this wait_queue_head better be a per-pool one rather than shared > among pools? It should be fine either way. All the involved operations are pretty low frequency. > > @@ -3338,7 +3332,10 @@ static void put_unbound_pool(struct worker_pool *pool) > > if (pool->detach_completion) > > wait_for_completion(pool->detach_completion); > > > > - mutex_unlock(&pool->manager_arb); > > + spin_lock_irq(&pool->lock); > > + pool->flags &= ~POOL_MANAGER_ACTIVE; > > + wake_up(&wq_manager_wait); > > + spin_unlock_irq(&pool->lock); > > > > Is the above code necesarry? IIUC, we are going to free the pool > entirely, so whether manager is active is pointless here and no one is > waiting for the ->flags of *this* pool to be !POOL_MANAGER_ACTIVE. > > Am I missing something subtle here? Ah, true. I'll drop the above chunk. Thanks. -- tejun