From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from stravinsky.debian.org (stravinsky.debian.org [82.195.75.108]) (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 98C70394794 for ; Wed, 5 Aug 2026 14:53:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=82.195.75.108 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785941590; cv=none; b=EavqcBNd4inE1ERSzJ5qQFVpTNEwICjUF5aCsLdgpiQoAgzIigUpOA9bjzA4V1ICgM4eVRpB163v98js/9+Iyy70+6mrVSiP9tQp/ycT9DexTL+I4U9HD+VmcftoH3UdkxPRIIwZB7uS0naJN1XbuR0j2AgylXZ2K7C39B4gAXo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785941590; c=relaxed/simple; bh=h6PjMr8Khq/9mcUDHIldyAYpVmx2YQ0WkLgY8uoy+eg=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=XQguK6AEDH5rsoghAE+tEcvIMJAGsE1Qt8km1HdPaWdmsRrU+WwheWmIvtEwfv3lo5YST/dGYx/06iM1JhkUbXFwGwzkNfLtDeDB32Q1MXT2Wn6SrW5uxW/A+w32UvUD7lCUD9qqouemC4ec4dwQqEeYPvwDNVaI8OZVUANY7to= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=debian.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b=wReBl63y; arc=none smtp.client-ip=82.195.75.108 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=debian.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b="wReBl63y" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org; s=smtpauto.stravinsky; h=X-Debian-User:Cc:To:Content-Transfer-Encoding: Content-Type:MIME-Version:Message-Id:Date:Subject:From:Reply-To:Content-ID: Content-Description:In-Reply-To:References; bh=QMuPNQhZN2yFgd4sqqctr6ifYKs+3VsPg1BsYNSV8No=; b=wReBl63ySrUvXDjJloAW2OzjX5 172MEDSZGYJeYCrNQ89cOn0MgBMeZyxz9TGJDL0AA+KjPtg05iYfOiMnbOV86GQ/uFhJ+praYlutu 7+ZwBKlz1k7UTtUSq9FjuSWsqdA/aE2zaJOcvOrS/FVNl8vpeuf0Eufwsz4ywbG+216L83luek2MN xUWMidSbp8/aaagJOhkawcjbMJ2fxFM1D7tQmDkll0eGoruXnMpd5HU9GtX7fVpVvIyTsrZF6d//e CJN5Otcshy2FYJ9Evm+kABeQmXeEX6sHM7HpmlRrNpVJnhhW8s/YUuD7Ie9begayMa2Jf4ttxtkmx HVK68P/g==; Received: from authenticated-user by stravinsky.debian.org with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1wrczO-00DzfM-0Q; Wed, 05 Aug 2026 14:53:02 +0000 From: Breno Leitao Subject: [PATCH v2 0/9] workqueue: base pwq pool release and nr_active on the backing pool Date: Wed, 05 Aug 2026 07:52:27 -0700 Message-Id: <20260805-wq-pool-refactor-v2-0-fd498d01d695@debian.org> 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="utf-8" Content-Transfer-Encoding: 8bit X-B4-Tracking: v=1; b=H4sIACtOc2oC/2XNQQ6CMBCF4as0s6amLVGQlfcwLNoyA2MMhRZRQ 7i7Ad25fMmf7y2QMDImqMQCEWdOHHqohMkE+M72LUpuoBJglDmpwpzlc5RDCHcZkayfQpSKnCk Lo6nMCTIBQ0Ti105e6+9OD3dDP23OVnScphDf++est+7H5/qfn7VUskRLhfaNdUe6NOjY9ocQW 6jXdf0APZfaU8MAAAA= X-Change-ID: 20260729-wq-pool-refactor-0fb28721f83f To: Tejun Heo , Lai Jiangshan Cc: linux-kernel@vger.kernel.org, marco.crivellari@suse.com, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.16-dev-f8e9d X-Developer-Signature: v=1; a=openpgp-sha256; l=2823; i=leitao@debian.org; h=from:subject:message-id; bh=h6PjMr8Khq/9mcUDHIldyAYpVmx2YQ0WkLgY8uoy+eg=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBqc05K+FeuGy3VaFJJqcrXsDTLLG2eEnlm8DoLY CxUy2+zwPaJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCanNOSgAKCRA1o5Of/Hh3 bS0lD/0UcL8K+1NCMQCROdxdEgG8JiDdQkhuCW8LS0/bDQEDRqU6qbC515xJ+I/Jo5KFT9xNlfx q2nN3Hvuaz6ygiWFAoHnEONIKpciIbBdR+FnmDTMn+0t6xjvox8oQDIU7rLhEoVJufofnMLpdfd EbpLJwZEjTwPfXgND4JY/dmnGRMDTxX/VrQLp4GSfysrfrzPzpY+x7It8Lio20k4LWeTYclW5pA sC7YHcJnS3WUaU1zep/4Z8yI0zcD5myBBJvRR6Chphk+omPunoRvXqkTrWtbkyT+xxWZOjq9c9f T/9TCzmyXYbPLi1/AG/djKx9Q3zozKSjfUuloI0pXkRUT6W5ak4V/eiY5AcbsOPD9taity7XG8S ugXnfOxvRTPHW/su7EwvEsB8aKaniQ+uBdg6zGZ/A8NQe+Na5a85mETQ0qAiQbIJEoVPzIbE12P tt8fYAqiB0Dh+WDQ8V+aBVuoFxUBmL/82EvNnDEactfy40+xp9q2LnZlb5T6G/WcqEigovlqo3H GdFPMcKnco9bxQUzaxLpBmNYUziQq3n352mwp965hnnfTc+sep6v14VMXFYBtsLgzzc0N3DT6HQ zR8ETFRUWsDvBg6NsJOslYMLtbtsZo0ZC26T48zPtpEqTmhHkdK9dvYaH0TzJvm0cfebIUbHDYc HPbvMnZRSJomCHA== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D X-Debian-User: leitao The goal is to unify per-cpu and unbound workqueues onto one backend, so an unbound workqueue can run on the concurrency-managed per-cpu pools and WQ_PERCPU just requests that backend [1]. This series is preparation and changes no behaviour on its own. These changes also is a reasonable readability cleanup. Design principles, as discussed in [2]. a) There is one workqueue implementation -- what is today the unbound one -- and percpu becomes one of its affinity settings rather than a separate type. The unbound_* helper names get renamed/removed once they stop being unbound-specific. So, `alloc_unbound_pwq()` becomes `alloc_pwq` and handle both cases. b) There is one pwq path, and alloc_and_link_percpu_pwqs() goes away. c) Which pool backs a pwq becomes a property of the attrs, resolved in alloc_unbound_pwq(), which hands out either the static percpu pool for that CPU or a hashed unbound one. d) Both pool types stay -- concurrency management only exists on the percpu ones -- so what gets merged is the machinery, not the pools. e) This is the prep phase for the changes that will come once we are happy with these changes. What will come later: * Introduce a concurrency-managed per-cpu affinity scope (WQ_AFFN_PERCPU) — percpu as an affinity setting * Direct pool selection (fold the create-then-convert), * Dynamic switching between per-cpu and unbound backing for CPU isolation. [1] https://lore.kernel.org/all/ak569WYSm3ygKl1-@slm.duckdns.org [2] https://lore.kernel.org/all/anDImojbi6lq0zUg@slm.duckdns.org/ Signed-off-by: Breno Leitao --- Changes in v2: - Removed the ugly __WQ_PERCPU_POOLS - Renamed some helpers here and there - additional patches, removing the "unbound" from function names - Link to v1: https://patch.msgid.link/20260731-wq-pool-refactor-v1-0-8eaf71cdab5f@debian.org --- Breno Leitao (9): workqueue: factor out get_percpu_pool() workqueue: factor out alloc_and_link_percpu_pwqs() workqueue: release pwq pools by pool type workqueue: account nr_active by the backing pool workqueue: test WQ_UNBOUND explicitly in the hotplug loops workqueue: rename wq->unbound_attrs to wq->attrs workqueue: allocate attrs for all workqueues workqueue: rename alloc_unbound_pwq() to alloc_pwq() workqueue: skip the node_nr_active update for non-unbound workqueues kernel/workqueue.c | 166 +++++++++++++++++++++++++-------------------- tools/workqueue/wq_dump.py | 6 +- 2 files changed, 96 insertions(+), 76 deletions(-) --- base-commit: dbff1ec23f68640a743512e8ada125795d1b72c7 change-id: 20260729-wq-pool-refactor-0fb28721f83f Best regards, -- Breno Leitao