From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754811AbdJIPIN (ORCPT ); Mon, 9 Oct 2017 11:08:13 -0400 Received: from mail-qt0-f195.google.com ([209.85.216.195]:51346 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754098AbdJIPIM (ORCPT ); Mon, 9 Oct 2017 11:08:12 -0400 X-Google-Smtp-Source: AOwi7QAEQ9n9a8zjkjWqXsakGqs+i6XRmKN/XDNTQVDkb5UXeGza9W1uML6tw66WVGrOGv/scmPVDg== Date: Mon, 9 Oct 2017 08:08:08 -0700 From: Tejun Heo To: Lai Jiangshan Cc: Boqun Feng , LKML , Josef Bacik , Peter Zijlstra Subject: Re: [PATCH workqueue/for-4.14-fixes] workqueue: replace pool->manager_arb mutex with a flag Message-ID: <20171009150808.GD3301751@devbig577.frc2.facebook.com> References: <20171008090225.27034-1-boqun.feng@gmail.com> <20171009132104.GZ3301751@devbig577.frc2.facebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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, On Mon, Oct 09, 2017 at 11:02:34PM +0800, Lai Jiangshan wrote: > I was also thinking alternative code when reviewing. > The first is quite obvious. Testing POOL_MANAGER_ACTIVE > can be replaced by testing pool->manager. > And POOL_MANAGER_ACTIVE is not needed. Isn't it? put_unbound_pool() doesn't have to be called from a kworker context and we don't really have a kworker pointer to set pool->manager to. We can use a bogus value and then update pool->manager dereferences accordingly but I think it's cleaner to simply use a separate flag. > The second thing is to make manage_workers() > and put_unbound_pool() exclusive. > Waiting event on POOL_MANAGER_ACTIVE(or pool->manager) > is one way. However, the pool's refcnt is not possible to > be dropped to zero now since the caller still hold the pool->lock wait_event_lock_irq() drops the lock if the condition is not met before going to sleep (otherwise it wouldn't be able to sleep). > and some pwds of the works in the worklist. So the other way > to enforce the exclusive could be just doing > get_pwq(the first pwd of the worklist) and put_pwq() when > the manage_workers() done. And the code about > pool->manager_arb in put_unbound_pool() can be > simply removed. Yeah, that part is removed. Thanks! -- tejun