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 E9D963859CB; Fri, 27 Feb 2026 19:08:56 +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=1772219337; cv=none; b=JPqaDoHeQtnqtoZGjIZMa5VjdGrDXXfK8grDKxxweHWkeTEFv+mLZ6QXXa++L7Xr0eqpATZD7WZTlYoURSE62s3CoIo3SaJ5g7Ok5zDhY/jUD4CeP7vUzrjyUj11oHvXOLstXUCJV/R01jwKcmhi+4ii4u3OEKpeEHzwPV7bdlU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772219337; c=relaxed/simple; bh=OX3Fxxu84DxxqCLZDuNx1vaZ6SJgo1D7Ku/XQzsJrvY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=UjScw7WYNgQATsT48tJdrJkqOWDeKg1QPMXmC8fKg/6WhRmOzanIg62DTr9laydCKs+x5EwRkMomy9uhsfri2fsNfbpKzOrcVQU8QlMzgCJb694uaQeArTePly7q+v5eeA7FJS0DJrYu1ZS8uM0fUzraxq/4/TzkFYZ+/8nhwKw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sOcrH5QY; 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="sOcrH5QY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F191C116C6; Fri, 27 Feb 2026 19:08:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772219336; bh=OX3Fxxu84DxxqCLZDuNx1vaZ6SJgo1D7Ku/XQzsJrvY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=sOcrH5QYJOUZ4r/9jMDxJ7qq3Jx5oNyBOVt3DSvtLNAA4NlWWiqi367iJbOOu0B7+ yuzwGNc+bGfIq5w8h/asqp3R8g4fFBFEl5NGDjxXs/n4gc2GO7061X5dv0icV0J5Gl JFTTefnDxm/ahqqv9bSz5gk2OU0wAYDOHRqAuv9uO1tSW+usgnJRZ/0uGM6dapyUG7 /V/MIl1MnObtbFD22zQxUupUFEjGRGHFS3IEg4CsaqTm+NjXPSEF4xy1twGENSBWqy 28z9vM5ZkKz4WP2g30wSG0JOLV5sR5Mj2BxFOhJZwjVZKJ5guINuhpmniMJ/2EyWbk NB3qrNTUz/3BQ== Date: Fri, 27 Feb 2026 09:08:55 -1000 From: Tejun Heo To: Alice Ryhl Cc: Miguel Ojeda , Lai Jiangshan , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Andreas Hindborg , Trevor Gross , Danilo Krummrich , Daniel Almeida , John Hubbard , Philipp Stanner , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Boqun Feng , Benno Lossin , Tamir Duberstein , stable@vger.kernel.org Subject: Re: [PATCH v3 1/2] rust: workqueue: restrict delayed work to global wqs Message-ID: References: <20260227-create-workqueue-v3-0-87de133f7849@google.com> <20260227-create-workqueue-v3-1-87de133f7849@google.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: On Fri, Feb 27, 2026 at 07:01:18PM +0000, Alice Ryhl wrote: > On Fri, Feb 27, 2026 at 07:09:07AM -1000, Tejun Heo wrote: > > On Fri, Feb 27, 2026 at 02:53:20PM +0000, Alice Ryhl wrote: > > > When a workqueue is shut down, delayed work that is pending but not > > > scheduled does not get properly cleaned up, so it's not safe to use > > > `enqueue_delayed` on a workqueue that might be destroyed. To fix this, > > > restricted `enqueue_delayed` to static queues. > > > > C being C, we've been just chalking this up as "user error", but please feel > > free to add per-workqueue percpu ref for pending delayed work items if > > that'd help. That shouldn't be noticeably expensive and should help > > straighten this out for rust hopefully. > > I had been thinking I would pick up this patch again: > https://lore.kernel.org/all/20250423-destroy-workqueue-flush-v1-1-3d74820780a5@google.com/ > > but it sounds like you're suggesting a different solution? I'm not remembering much context at this point, but if it *could* work, percpu refcnt counting the number of delayed work items would be cheaper. Again, I could easily be forgetting why we didn't do that in the first place. Thanks. -- tejun