From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F290E191; Wed, 1 Apr 2026 00:05:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775001943; cv=none; b=O4jcJN+xwkZ2WFF5saemyedXuyXt+FDTsUWXIRZq2ut6J4FpOzIzYECTEO4N+jLYxTHLqBxXzkDYjj4q3vY8mxbOSBrLh2qmeUiGCV07XRFuP+xysP7N9N1E/CdSqe6MRN+DPnjOh+0mefAqvR9fuB6wcVTg5yYSQSqSah3tXwU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775001943; c=relaxed/simple; bh=Z5BZ/JumfybSInyb3/dNCVeo40Y5CQhBHcoIcom2nVs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Yyj4KZmawQU1KQognmuWdmSE9ptJpxx/uCMG1URo30QwCg5uRv/KVsu3cDL5+6jPewHwMlMKDebMOu/a+3yuLFQY8twU1QEgPOPUTsxghx7LmQyqFx9SddkK2mCl6DtF9MAyprHQR3qlPDZ63Z2HREPCflTga86bRiNPOaOa2bQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=W1tY15Y6; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="W1tY15Y6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 72700C19423; Wed, 1 Apr 2026 00:05:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775001942; bh=Z5BZ/JumfybSInyb3/dNCVeo40Y5CQhBHcoIcom2nVs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=W1tY15Y67eOqzSQF1clsFT+4WXALa93aYxetdZUXEO07Pyd41uHHNllqhiqwpZcgH ObQjjvgXDVnazSuyFWw4s0Y8i51/Cma9fZ6V5aToGc3x8ixyH2Dj4cD4p62MZMsEJK zqywnUxcUnjiJmbnksDDyqn4qpUnYIUJZV10E3Kg1yFmTKPkdLp0yn/VMaQer2YeI/ Xvm2z1UTTd3VFBiKyV+thFTLN16OV8was8dzUW37K2AgvxpKOhoh/ZOjIF0xFGXKCc +7XZauKJxOQVg434eD5fCjjJGx1ay6HMQzRGD0Fx6AA1Vuf959pblL9ziIbnPMQitS 4zMp/0JlgMb4Q== Date: Tue, 31 Mar 2026 14:05:41 -1000 From: Tejun Heo To: Matthew Brost Cc: intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Carlos Santa , Ryan Neph , stable@vger.kernel.org, Lai Jiangshan , Waiman Long Subject: Re: [PATCH] workqueue: Add pool_workqueue to pending_pwqs list when unplugging multiple inactive works Message-ID: References: <20260331221839.1033423-1-matthew.brost@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260331221839.1033423-1-matthew.brost@intel.com> Hello, On Tue, Mar 31, 2026 at 03:18:39PM -0700, Matthew Brost wrote: > @@ -1849,8 +1849,20 @@ static void unplug_oldest_pwq(struct workqueue_struct *wq) > raw_spin_lock_irq(&pwq->pool->lock); > if (pwq->plugged) { > pwq->plugged = false; > - if (pwq_activate_first_inactive(pwq, true)) > + if (pwq_activate_first_inactive(pwq, true)) { > + if (!list_empty(&pwq->inactive_works)) { > + struct worker_pool *pool = pwq->pool; > + struct wq_node_nr_active *nna = > + wq_node_nr_active(wq, pool->node); > + > + raw_spin_lock(&nna->lock); > + if (list_empty(&pwq->pending_node)) > + list_add_tail(&pwq->pending_node, > + &nna->pending_pwqs); > + raw_spin_unlock(&nna->lock); > + } It's a bit gnarly to open code locking and list operation. Would just calling pwq_activate_first_inactive(pwq, false) one more time work here? That'd trigger tryinc_node_nr_active() failure in pwq_tryinc_nr_active() and the addition to the pending list. As this is quite subtle, it'd be nice to have some comment - it's compensating for the missed pwq_tryinc_nr_active() call due to plugging, right? Thanks. -- tejun