From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f73.google.com (mail-wm1-f73.google.com [209.85.128.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B91DE36EA82 for ; Fri, 27 Feb 2026 19:28:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772220495; cv=none; b=VRK578Hp/0v5ooIv/5Pivy4ZvF+8Q2W9v0GFWvesgTm15H7t9BBGUO58zxNoUawFnORjYgfXVse7W1OM6YxwY61sFU9DxSfYczZQz3jrm1w+aRD6zvdYwx2glcttlh26VgwUpooeJFU7l3qhFsrVfNqtx2/UR0uUyr/WZ+dlK5A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772220495; c=relaxed/simple; bh=HfVDmGC4fB3MiRfy2NmM8QDzL0ngy1GxNiE1UvPUglM=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=YNBi0VKtmpzKmlaq4sS4ZIR+nTOWI+A3gciKKE71FuAzNQzUEs4uYRxLsCwlUtz3AzHw4bjgFd/o2ua0Q22LHYmc7KjM/LBnG82eCjRYKmRCK/O9+mNzkv+CJOOxy0QnY/dOgFyRhsDPEeeqbtQ/MfLvc+UpSsNpT1PMNxkhZ+M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=pwg7qZeS; arc=none smtp.client-ip=209.85.128.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="pwg7qZeS" Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-48378df3469so15046215e9.1 for ; Fri, 27 Feb 2026 11:28:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1772220492; x=1772825292; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=w1HcWsQPS7f+mcem6RVU74G7Wi+GwI58L79rKUSwDFo=; b=pwg7qZeSJeHFvzKt9o6skkwd7BF9E0NkMset5m4FOpTOC+Ki5A4QecbY445B2Mf4DQ kEDnjWx+zcApBKkUXcNOVIjataP08wdFNaNVG8Y23kuT8h3DTErjOrqc+9GKh2vzNKwC EumL0Q8yggt21gazgHckhK981jwUwXI3RB6Dnh8aB2FlTlLNFYvTz1yUv+FHFVzOHA34 04jwx+a5CZ4qj8kvUnxpYHj2Y0F00eX0IOpONyMCC3rMS0w8tzUxGn2FC39fpEril06u 2hcBXY4ONE54t+Wzwy95iVFrfm7BVL7CCTOFnTVT20IrjoJvVFiPC5P+Ai4LbC+rhJdE 6ldw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772220492; x=1772825292; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=w1HcWsQPS7f+mcem6RVU74G7Wi+GwI58L79rKUSwDFo=; b=FXrvHzhsprMwHhDJbzUrugp3PExKRx9kxfooxXazfcYwSRZxb2F58G96zzIyvuNzHI uJcvRkaXOb0K4sDHPMykdVSv8wBqX2JxNpUEbe2ekEkIRRq7/AkkKJg8cA1IXiWPRzBR d5Q3dus51EAi+Zwn1Q5liGibLW2JnG6ghvCvIZhz2jb/lLTuAqig4Tq6SzPbZPq2SYgt 0J0NKI+TC5172uQS+cN9U+GZ+zymHJWViLtWU/J5jtka13UvTyDoU2X0yqcObE3G/2MA s4bfuBGUUKdFZlxYyCpNXECCv82v2oT1ZQvj5yoR+lzydREzsz9nbbgARVoZ/ZI5ZYYW 8L7A== X-Forwarded-Encrypted: i=1; AJvYcCWKnN+Hh1Ep39KD4pwkWCpFoYiJQ9KEM1bGUJuYuSEK9AW5F8P9Nx7nd18tKivkIwvIkOlGM/og2bTzNcs=@vger.kernel.org X-Gm-Message-State: AOJu0Yx695VwqzbyqgjPZH/l0OksV/vCoIIJVdBiMz/um1kpSysmNtDA RVNkwWuj2Rst+BsmLh5/eZDEFLL6xzj4K+ndeO6tT/1n/Ot45ax8zol5R2qmqRxEdlik5bkAEZ9 qRKXJPWaWXJRnLCEniA== X-Received: from wmxb15-n1.prod.google.com ([2002:a05:600d:844f:10b0:480:4a03:7b80]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:1c1d:b0:483:4b37:8620 with SMTP id 5b1f17b1804b1-483c992e330mr68942145e9.10.1772220491946; Fri, 27 Feb 2026 11:28:11 -0800 (PST) Date: Fri, 27 Feb 2026 19:28:11 +0000 In-Reply-To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260227-create-workqueue-v3-0-87de133f7849@google.com> <20260227-create-workqueue-v3-1-87de133f7849@google.com> Message-ID: Subject: Re: [PATCH v3 1/2] rust: workqueue: restrict delayed work to global wqs From: Alice Ryhl To: Tejun Heo Cc: Miguel Ojeda , Lai Jiangshan , Gary Guo , "=?utf-8?B?QmrDtnJu?= 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 Content-Type: text/plain; charset="utf-8" On Fri, Feb 27, 2026 at 09:24:34AM -1000, Tejun Heo wrote: > Hello, > > On Fri, Feb 27, 2026 at 07:19:56PM +0000, Alice Ryhl wrote: > > I guess the question is, what does destroy_workqueue() do? > > > > - Does it wait for the timers to finish? > > - Does it immediately run the delayed works? > > - Does it exit without waiting for timers? > > > > It sounds like the refcount approach is the last solution, where > > destroy_workqueue() just exits without waiting for timers, but then > > keeping the workqueue alive until the timers elapse. > > > > The main concern I can see is that this means that delayed work can run > > after destroy_workqueue() is called. That may be a problem if > > destroy_workqueue() is used to guard module unload (or device unbind). > > delayed_work is just pointing to the wq pointer. On destroy_workqueue(), we > can shut it down and free all the supporting stuff while leaving zombie wq > struct which noops execution and let the whole thing go away when refs reach > zero? But isn't that a problem for e.g. self-freeing work? If we don't run the work, then its memory is just leaked. Alice