From nobody Mon Sep 28 18:36:21 2026 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 7FA443A1A22 for ; Wed, 19 Aug 2026 14:37:51 +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=1787150273; cv=none; b=TQPG2JgOWO7s6eCU6jdhaO9ReYL5u5fhAh6rIP3WRFKCE8Og+yXwsVFkNGqQX76LImlKLiddd0cJyewZujEXTOJNoFIRFwadgc2K4Wnjsbvoq8Q6YGRk8K9ibnxbze5gH0l4m11sqiosPns/RG4PLkgBVIjiWChILeYdEalREsM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787150273; c=relaxed/simple; bh=bId0lP/ilJ6VTnCkSzwMTNmEjXSuQ1Z+ZTCzCHlKjGU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WfTQG/yZXiFbjsYbYWgVt5tJxs0CMdr8pVwbxG74zrkv2jmBs9Odi0u0FQpPS+SkFGmjfPz5Xo7EO9FYS5cwKJKRi6X9bCtteOlsleSrtOlaBD6Xqn37jHynB8LMDVc717AF18UKUVx+n8qk9YmMRd44HKBIkN3JqzsCKhA7A54= 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=XHkRE5UZ; 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="XHkRE5UZ" 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:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description; bh=ZB8dIWNkjje6KqhyiaR7DCpmPcwcqlf5KXC+AajJjKY=; b=XHkRE5UZlwsO2PQerT5mnOQDpW 5VnSveNwjTmDdDX8bGxwQexEbX94CzkPw0zpF0TMWo/S5nCkp/MY7MsXaccV7tmUvLFwkCGIGCU6a PWVgWG0cL2qL+vYOybUzDjDe5JWj15o3+UiQCgmMx4BZWaTXWExXLxjeD9AW+7ZtB1Q85FS/WY/tG YLVCXTPR2PJgKGvgJufptK88VsvaGLZZD3sULII9A+8HoY0ngzzu2OWviIISo0J/ZN6j1by5FKBdw YPip8vedoPHkXpInDWLIiqjYpIanxd9kNBbYRSrVvUw8Zuzm7PoL202jaV+sF/7Hir44RkuQ/Jr7m XHQKZLiA==; 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 1wwhQK-009rMH-15; Wed, 19 Aug 2026 14:37:48 +0000 From: Breno Leitao Date: Wed, 19 Aug 2026 07:37:35 -0700 Subject: [PATCH 1/5] workqueue: move the unbound-only attrs check to apply_workqueue_attrs() 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: quoted-printable Message-Id: <20260819-wq_realsplit-v1-1-6ad3c3f48be8@debian.org> References: <20260819-wq_realsplit-v1-0-6ad3c3f48be8@debian.org> In-Reply-To: <20260819-wq_realsplit-v1-0-6ad3c3f48be8@debian.org> To: Tejun Heo , Lai Jiangshan Cc: linux-kernel@vger.kernel.org, pmladek@suse.com, marco.crivellari@suse.com, gustavold@gmail.com, david.dai@linux.dev, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.16-dev-f8e9d X-Developer-Signature: v=1; a=openpgp-sha256; l=1398; i=leitao@debian.org; h=from:subject:message-id; bh=bId0lP/ilJ6VTnCkSzwMTNmEjXSuQ1Z+ZTCzCHlKjGU=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBqhb+0lnJv0s0iZ7XTuHZVf+FW4fqFpa4GyAAe5 tiKRVTlBJ2JAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCaoW/tAAKCRA1o5Of/Hh3 bZlyD/wJ+vPvtqazOij3QkaVmznftoUKzLEoXiDA+jThgLpEQk7Vni1Wyj4wuqRYPoHPVS1b05l aa+no7a7j9+58dzBx99M4W5wT5CKjRZQb6Rty8uM/zuZUrb6hydZdOWi8WPyx2LhwAjS+CRdMyL l3p2EmbcX9kMvC4Vl2TocpvMKN2PgqDyF0VSho5sRRmXeGmc1GvgLXiuV+S7NpjX8vA/qVx9QDP qMhCeTHAyLsOEE3O8qmrU8XCK8BInYknHsZss2GgmaW45zRddU/fDTI79JQAo6OUs4FDKgbRjYE ewhTNfkEkmQNnhuWN8NECR/OXqeb8y0T5Og3NGtxR7vEvsG2KPZEfLNjrrZT5jOdgmDszw7tnN4 +uV5OUhtFEryaGyhlCNOq4h9NQ1PpT06y3r4CSN6vB+lH0hnpDmfJFBrfYrPWrWixDYQF55SqWe cFC0qz/re2L9HvvmUBzUbgjn8Wgaq+udWbe5HFxKEBbLQzWSb2Dy5mAO5uvpo6/U/e6fkTSSszW boxYKhBIsemOR60TUGQYkaMnZUCw4g3LbRsSfLtTvQLy+QFYxxvXKG/RSE0DB7TLYSVEIQzTpqt 1L8iolYyrxJVyVVpm+/lSxgvdJ9O1r7fyyrl24gUVVrBcJcg4rECFrTG8VddbdFanThLj1TAEdQ emvO9HNVAqdHeoQ== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D X-Debian-User: leitao apply_workqueue_attrs_locked() refuses any workqueue without WQ_UNBOUND. That is the right rule for changing a workqueue's attributes, but it also blocks the internal callers, and building a percpu workqueue's pwq table through this path needs them. Move the check into apply_workqueue_attrs(), the exported entry point, which is the one that changes attributes on a live workqueue. Signed-off-by: Breno Leitao --- kernel/workqueue.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 59b0106624e24..632d3f75f0c96 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -5568,10 +5568,6 @@ static int apply_workqueue_attrs_locked(struct workq= ueue_struct *wq, { struct apply_wqattrs_ctx *ctx; =20 - /* only unbound workqueues can change attributes */ - if (WARN_ON(!(wq->flags & WQ_UNBOUND))) - return -EINVAL; - ctx =3D apply_wqattrs_prepare(wq, attrs, wq_unbound_cpumask); if (IS_ERR(ctx)) return PTR_ERR(ctx); @@ -5603,6 +5599,10 @@ int apply_workqueue_attrs(struct workqueue_struct *w= q, { int ret; =20 + /* only unbound workqueues can change attributes */ + if (WARN_ON(!(wq->flags & WQ_UNBOUND))) + return -EINVAL; + mutex_lock(&wq_pool_mutex); ret =3D apply_workqueue_attrs_locked(wq, attrs); mutex_unlock(&wq_pool_mutex); --=20 2.53.0-Meta From nobody Mon Sep 28 18:36:21 2026 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 5A2BD3603DF for ; Wed, 19 Aug 2026 14:37:55 +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=1787150277; cv=none; b=chRkDPH2YhdVFH0xfYFG65PS+mQE/4RWGuhb7YRQ8+Sv6fUiVY4Sr7pVb+5dpowDJZBbQL8C0U2j11JM1+h0va0i/aFuVwc/sBWI9E48B/JLdGVxNMO1nyVimldyzLrUXrJ9Ks4WXWIDcVOHXdJgZ/uh0vlHpbTZXBeU0xsPW6Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787150277; c=relaxed/simple; bh=zzgvovP0hPKg+FWTlX1pBdkCCr3Pmx6Ci3qhAddZCEQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LnN5yYZZKKNV62AB6s9zHYLSCFId0JqhqOuVkDs+FDS+8uIQZSUMqAMGQfiFVB6lOJdiiWGYeNazfxCCifDcIWHBiPpjPBBIpCXrgi2xpxzI1kz97WpjVfsMs+MhqodrvNi0y7E7SNqNW+u5owavTJMnEbiZcaTXfpdDNUcffLg= 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=osWeBTQQ; 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="osWeBTQQ" 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:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description; bh=e4lwshxVbdALPCWifDAXmbeE9eQBlyZltuCaIOPauik=; b=osWeBTQQusOAsHoymfEWmZ7Z6O IgwX1WDfXfvjmALLYOfhhgquEbclCZ+V4KC0OBZDUzLGD/bc2X9WizuGnjyNbnnv/wP/0F4l/Ycr8 qzMpSdNDHg2SojZusEwq9GUw/t0JogJWsAlaUrw3KD2iw5Zwq3hDAqNbVsSXmQ0ILIydBmOW1iOrp UbKIhsNcNUHivnlQDgX9i11yTG0XOu50fDEbi5ta2nfqzMe37bNZmYWO34sQdZGHk01yhqXzLuD8C deivVQ4L+cqtNOqf+AjpY5bi0CYenHukGFpG124NFvohWsilMcq0WhKz4rBmJVpf1hPby0vClMM+v HU/CiT/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 1wwhQO-009rMb-0v; Wed, 19 Aug 2026 14:37:52 +0000 From: Breno Leitao Date: Wed, 19 Aug 2026 07:37:36 -0700 Subject: [PATCH 2/5] workqueue: resolve the backing pool in alloc_pwq() 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: quoted-printable Message-Id: <20260819-wq_realsplit-v1-2-6ad3c3f48be8@debian.org> References: <20260819-wq_realsplit-v1-0-6ad3c3f48be8@debian.org> In-Reply-To: <20260819-wq_realsplit-v1-0-6ad3c3f48be8@debian.org> To: Tejun Heo , Lai Jiangshan Cc: linux-kernel@vger.kernel.org, pmladek@suse.com, marco.crivellari@suse.com, gustavold@gmail.com, david.dai@linux.dev, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.16-dev-f8e9d X-Developer-Signature: v=1; a=openpgp-sha256; l=3327; i=leitao@debian.org; h=from:subject:message-id; bh=zzgvovP0hPKg+FWTlX1pBdkCCr3Pmx6Ci3qhAddZCEQ=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBqhb+03hBGCtqGgg2nMCj0cPVRDrhq0aSDi9Lmg ggr6+B7BtOJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCaoW/tAAKCRA1o5Of/Hh3 bVN+EACaZmnB558j4+p5ZBIDnMhQVCFBjj2lkAWPNj5sjPTDx+NKByLOLZH2rHi8jC7RTS1f5Xa jLL7NPknM2AlARfafl5kfkdDMpIy49/T59Dn5qx7GQJ6m+f0QHyYliXGrHtbiDX/NlAFV3ISRUp g0voCQXl5iXXoB9Eu9Aivto89dYqFpUdiLcFTfsnsKTUqaR6u2L3UVgkoqZZ18faYvBk5695aEd tjcXzvLnRBzAs9mVB6h4clSF1DNgWcNsE5gPIg8pbaE2tQgIbilgixV3BW3PLklEImcbLrfjG5x h9Gs1qVUjC1xtWSf89vOFf63kbIMGSV/rteTrwHzDUUAk7xHVL3e14lzRxeiV6YZ/Svj39zTmAR Woc7PoKwNopadclF+nLuLpMeoEKGBCLCEhv8jZoYNmkpLUfRDV948hHmJvkc7GH8Q+dlv6CYJ1H bVuXFcQkVSt9iy6TK1BazF+ENxNksuQ8lXE7sPdvFwjwlOLwQ5jf8OYmNR08AkHxj7WSIvUL0+l nYq8gdKHUwIXgSfSs+58dmI5vEjoDttqHq3Dcu72gpGrrPu84OWjc6Jci2AOJn2YoEyAZeGIGRQ 3jFNqoMKVc2gGcByPyg901Vw6JVGeO9HFKgu+nerwXJ/eFjSO18sRsQvabiHdLrsqsGi5TSiyBw muETw0/qnnO1lZw== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D X-Debian-User: leitao Unify the pool allocation in alloc_pwq(), instead of only getting the unbou= nd pool, and add a new parameter for the CPU. Create a helper for unbound allocations (alloc_unbound_pwq()). Signed-off-by: Breno Leitao --- kernel/workqueue.c | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 632d3f75f0c96..7feefe0a4a5ff 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -5376,22 +5376,34 @@ static struct worker_pool *get_percpu_pool(struct w= orkqueue_struct *wq, int cpu) return &per_cpu_ptr(pools, cpu)[highpri]; } =20 -/* obtain a pool matching @attr and create a pwq associating the pool and = @wq */ +/* + * Obtain the pool backing @wq on @cpu and create a pwq associating the tw= o. + * A WQ_PERCPU workqueue is backed by the static per-cpu pool of @cpu, + * everything else by a pool matching @attrs. @cpu < 0 is always unbound. + */ static struct pool_workqueue *alloc_pwq(struct workqueue_struct *wq, - const struct workqueue_attrs *attrs) + const struct workqueue_attrs *attrs, + int cpu) { struct worker_pool *pool; struct pool_workqueue *pwq; =20 lockdep_assert_held(&wq_pool_mutex); =20 - pool =3D get_unbound_pool(attrs); - if (!pool) - return NULL; + WARN_ON_ONCE((wq->flags & WQ_PERCPU) && cpu < 0); + + if (cpu >=3D 0 && (wq->flags & WQ_PERCPU)) { + pool =3D get_percpu_pool(wq, cpu); + } else { + pool =3D get_unbound_pool(attrs); + if (!pool) + return NULL; + } =20 pwq =3D kmem_cache_alloc_node(pwq_cache, GFP_KERNEL, pool->node); if (!pwq) { - put_unbound_pool(pool); + if (!is_percpu_pool(pool)) + put_unbound_pool(pool); return NULL; } =20 @@ -5399,6 +5411,13 @@ static struct pool_workqueue *alloc_pwq(struct workq= ueue_struct *wq, return pwq; } =20 +/* create a pwq backed by an unbound pool matching @attrs */ +static struct pool_workqueue *alloc_unbound_pwq(struct workqueue_struct *w= q, + const struct workqueue_attrs *attrs) +{ + return alloc_pwq(wq, attrs, -1); +} + /** * wq_calc_pod_cpumask - calculate a wq_attrs' cpumask for a pod * @attrs: the wq_attrs of the default pwq of the target workqueue @@ -5500,7 +5519,7 @@ apply_wqattrs_prepare(struct workqueue_struct *wq, copy_workqueue_attrs(new_attrs, attrs); wqattrs_actualize_cpumask(new_attrs, unbound_cpumask); cpumask_copy(new_attrs->__pod_cpumask, new_attrs->cpumask); - ctx->dfl_pwq =3D alloc_pwq(wq, new_attrs); + ctx->dfl_pwq =3D alloc_unbound_pwq(wq, new_attrs); if (!ctx->dfl_pwq) goto out_free; =20 @@ -5510,7 +5529,7 @@ apply_wqattrs_prepare(struct workqueue_struct *wq, ctx->pwq_tbl[cpu] =3D ctx->dfl_pwq; } else { wq_calc_pod_cpumask(new_attrs, cpu); - ctx->pwq_tbl[cpu] =3D alloc_pwq(wq, new_attrs); + ctx->pwq_tbl[cpu] =3D alloc_unbound_pwq(wq, new_attrs); if (!ctx->pwq_tbl[cpu]) goto out_free; } @@ -5655,7 +5674,7 @@ static void unbound_wq_update_pwq(struct workqueue_st= ruct *wq, int cpu) return; =20 /* create a new pwq */ - pwq =3D alloc_pwq(wq, target_attrs); + pwq =3D alloc_unbound_pwq(wq, target_attrs); if (!pwq) { pr_warn("workqueue: allocation failed while updating CPU pod affinity of= \"%s\"\n", wq->name); --=20 2.53.0-Meta From nobody Mon Sep 28 18:36:21 2026 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 5599E3B8950 for ; Wed, 19 Aug 2026 14:37:58 +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=1787150281; cv=none; b=hTy1tDFMY9QVL6CGZ8RK81i15I93W1l2IzmZKPVTkROnycgAo/DLQwmjz5DyEM27a6WO6g32CIGnhYyyyEnvjqmbKHrejwh1YCPMimdLmB+qKyUJ0Q580TvnXYF2T8AWRKCcOKQK+2vJZmtySSTHb4nfHzRBnrdfTVXfbrOedLk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787150281; c=relaxed/simple; bh=EmMbnmkNdc7gHt6EPIED2zXeqLtKeTU61koz1BD1kes=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=B+1XW+//ntgZxeWmRppcIDG7DkdvvDa4hCX1DxdTXT3y7BjUSB1YpmEvXrdbwgCEwzQW+gqYZ2inS7bVnkdPAQw4UTsdhPBRJLbhMGV9vdLCqprTsgadseU8SMxWk6Ew7s1pFsnm/YZZ2RhDAPoCdPcFoIZsr0IU+BzO79eCLUg= 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=FINmHXp0; 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="FINmHXp0" 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:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description; bh=OGnUKDcIWkkDLDXlDcUke2cWA+8xOgKdUO9jOgPu7iE=; b=FINmHXp0q3E8QrUwL/ldRy2XBG Oe4lXB3xXJAgiisqOgC9voiV+5O0whBJTEdwMyumzfRhUVZ0mpsJ5QrSEr6Ho2tpd+QX4zMLGSeZ7 JUP/GYEr5UF4qLEQCKbae4qEy30OCVmrtQpuRxeNwjhQXPVOnvh4rWPbPM6XvsJMOxtK3bJOp7PIh oPdAeLPCkWZvOBOBD2/O8/yawpCgcVPzVoDphhWBMnNfSn4CKlt2r4d8VA94SxQgZIBoOwGMOZUKc JO8yPERDVp+ua0JocEaluDypXUxe7coizAzO1DNtzwzQzM1J1+430pGEBh7Au0i6BpHABcqnMmmdW ANQXp9HA==; 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 1wwhQS-009rMm-0K; Wed, 19 Aug 2026 14:37:56 +0000 From: Breno Leitao Date: Wed, 19 Aug 2026 07:37:37 -0700 Subject: [PATCH 3/5] workqueue: make the default pwq optional 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: quoted-printable Message-Id: <20260819-wq_realsplit-v1-3-6ad3c3f48be8@debian.org> References: <20260819-wq_realsplit-v1-0-6ad3c3f48be8@debian.org> In-Reply-To: <20260819-wq_realsplit-v1-0-6ad3c3f48be8@debian.org> To: Tejun Heo , Lai Jiangshan Cc: linux-kernel@vger.kernel.org, pmladek@suse.com, marco.crivellari@suse.com, gustavold@gmail.com, david.dai@linux.dev, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.16-dev-f8e9d X-Developer-Signature: v=1; a=openpgp-sha256; l=2072; i=leitao@debian.org; h=from:subject:message-id; bh=EmMbnmkNdc7gHt6EPIED2zXeqLtKeTU61koz1BD1kes=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBqhb+0uL3gKQGRfhZfpLZNd6ElNkf6MirFWGY3R eZY7oSG3EKJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCaoW/tAAKCRA1o5Of/Hh3 bXCyEACVlMVt4Bo8w4Pfbc84AYKBctR2QhnLp/O0izUtVyvE+jRX73kG+DOKAcKr8q6abg7MbGe zlnOQBod4yejOfsC0ictDWRVRwBnDFWXtN7BKu7Cvyyd9+6d1xCB1wcAiKtAnkyNcp04Y0SHIWY C3mMtCQmB2xGDoM73fBcD7J/bLrhmz/t0jfpOXbH4Jm/CdYIwG46zcKmUXRQzTgWGVeatmbQhxM 2rsctWsMDuLGB7HZCs8TXkKNdKrBg31zBcKniT/xdeipBvHa2vhqWZkUDG7Z/lsc0EaSkFK+zK6 jEunZnWXhTIv134VV0Y22A1BdplY0gd6xAQ6k1szLCQYe85sJkEOwrJ8pOkutR11+DBKswsTOAO p3RposkDJNU6XwsuSZm03JjP9fO4oLHaKUfShSwBL3ZLBCwPkhTMayezsZWUb07y4oN/6yt09BU JlPBamrYqrWd4xLucyq38L8itLS/oU2w1Rs15DFOql1SbHFtFlDXYGNFE5yriym+HCQVlJyRQb4 5m+UanwpTV47BFaBy08s+Mvas+QXGRXb67VoUTOiuqhh7Hf0lNU5hSp6G3O/Yk7r0ZjSGifnMoI waQqqrBVCOBpIjxAhWzvS1sXTWOwfSJLJ6exr/ubhlxSZ5vH9JdFHj7/3GImsuXcQ8bLAkHv4af IIF/GOkG5seloYg== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D X-Debian-User: leitao apply_wqattrs_prepare() always creates a dfl_pwq, the fallback a CPU uses when it has no pwq of its own. This is a CPU unbound field, so, we don't need it for the per cpu affinity version of workqueue. A percpu workqueue has no use for one. Skip the allocation for a WQ_PERCPU workqueue and skip installing what was not allocated. Signed-off-by: Breno Leitao --- kernel/workqueue.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 7feefe0a4a5ff..8fac93574becb 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -5513,15 +5513,18 @@ apply_wqattrs_prepare(struct workqueue_struct *wq, =20 /* * If something goes wrong during CPU up/down, we'll fall back to - * the default pwq covering whole @attrs->cpumask. Always create - * it even if we don't use it immediately. + * the default pwq covering whole @attrs->cpumask. Create it even + * if we don't use it immediately. A percpu workqueue has a pwq on + * every possible CPU and never falls back, so it has no default. */ copy_workqueue_attrs(new_attrs, attrs); wqattrs_actualize_cpumask(new_attrs, unbound_cpumask); cpumask_copy(new_attrs->__pod_cpumask, new_attrs->cpumask); - ctx->dfl_pwq =3D alloc_unbound_pwq(wq, new_attrs); - if (!ctx->dfl_pwq) - goto out_free; + if (!(wq->flags & WQ_PERCPU)) { + ctx->dfl_pwq =3D alloc_unbound_pwq(wq, new_attrs); + if (!ctx->dfl_pwq) + goto out_free; + } =20 for_each_possible_cpu(cpu) { if (new_attrs->ordered) { @@ -5573,7 +5576,8 @@ static void apply_wqattrs_commit(struct apply_wqattrs= _ctx *ctx) for_each_possible_cpu(cpu) ctx->pwq_tbl[cpu] =3D install_unbound_pwq(ctx->wq, cpu, ctx->pwq_tbl[cpu]); - ctx->dfl_pwq =3D install_unbound_pwq(ctx->wq, -1, ctx->dfl_pwq); + if (ctx->dfl_pwq) + ctx->dfl_pwq =3D install_unbound_pwq(ctx->wq, -1, ctx->dfl_pwq); =20 /* update node_nr_active->max, which only unbound workqueues have */ if (ctx->wq->flags & WQ_UNBOUND) --=20 2.53.0-Meta From nobody Mon Sep 28 18:36:21 2026 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 EA08B397924 for ; Wed, 19 Aug 2026 14:38:03 +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=1787150287; cv=none; b=j8BXd3byuay/i43SB0a4xBg5GWjVinV5qmtQ1iXXPk+nvPvSitl6xcPD8XTO1EHYTkqDV3lyjjqR1YV1OeRYXr5nMvmNXlGZCU3ShdqmgDu4YThxwlHVSzzgz6hmRZK0cwgcnfdi2DhY4sB6KU9OQkzMD/XP27MrI8MAKsGTq1E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787150287; c=relaxed/simple; bh=P4LoM4ztCxDgZ0tKzIK62RCCNoVWBQBZChILt0uCsNQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qVYfhUEIvNLX6UPv9xfwoeu09dxcWgDMYHVsCNq2VitvHjN7GPa60wMFrcFQfLqNyh0AviaHNpcZxCNtU8ZDHyTocuye96FeFT2w+2ZUljUzSEalecCJW/wMN5n7U+zo6sw4P+ZjoncDpXwJPeut4pMSkUsklnoGLOjzT7vruWE= 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=rUrmZBUZ; 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="rUrmZBUZ" 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:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description; bh=U0t7Qv2z7J5Gejbyv54PhNI+53asXnJnfhsqUwyAKUc=; b=rUrmZBUZdQ/hdqwvvsYHIwYTgB RWj2R7c0eIEdM/aELHfld1VKnZ7h5IW1+Ok+FKYEHgye4mQix15jymynso2Q77R7DfHRSueGpOMBC JmwSNqeutc9D0R/yTGkRcS/8BQ8JNBsj1o/PdNlxy80wJc1zzX3Fpp/CmkwmsJgrKVSV8XHz71K9O fP+TZtfw0iOGTX4KUt8mosKDfwO+EWEaXQgljDsVOgEruisMyHNKpMo2Tz/WcL3Sq7q4eaDnGpJ+5 0HA5b/EX6xxrb37hjTvfNYSM8RY4WtZ5NZAn11uY/JLMvAHYhC7bxX9LxfhpJ407TnhcIBDajCvwN YbsxF10Q==; 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 1wwhQV-009rND-1v; Wed, 19 Aug 2026 14:37:59 +0000 From: Breno Leitao Date: Wed, 19 Aug 2026 07:37:38 -0700 Subject: [PATCH 4/5] workqueue: build percpu pwqs through the attrs path 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: quoted-printable Message-Id: <20260819-wq_realsplit-v1-4-6ad3c3f48be8@debian.org> References: <20260819-wq_realsplit-v1-0-6ad3c3f48be8@debian.org> In-Reply-To: <20260819-wq_realsplit-v1-0-6ad3c3f48be8@debian.org> To: Tejun Heo , Lai Jiangshan Cc: linux-kernel@vger.kernel.org, pmladek@suse.com, marco.crivellari@suse.com, gustavold@gmail.com, david.dai@linux.dev, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.16-dev-f8e9d X-Developer-Signature: v=1; a=openpgp-sha256; l=4816; i=leitao@debian.org; h=from:subject:message-id; bh=P4LoM4ztCxDgZ0tKzIK62RCCNoVWBQBZChILt0uCsNQ=; b=owEBbAKT/ZANAwAIATWjk5/8eHdtAcsmYgBqhb+0G+pDW7KlsR/uRpL8jZKEkgsFnF69RdoEQ FC5e6W1JOOJAjIEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCaoW/tAAKCRA1o5Of/Hh3 bW3YD/Y/xWJgsN3Ues8tjcpV+NIWI1j4aOMogCXLizbthv3cIkqBYlswxPDfQ1Urs6Tv1GUutqZ rB775/lEGmQaLJRKA6JjA/V3Nq5HndZbh65YhQnE85OYvBTEp4j1eDgiWljtXGQx0UeR2JCgPGZ y+qfu4rwS1sA99M1QZw9hbJbNnRHkpGTRwZuTtUPKdTJPc9hgiOkM9cyAiY38SblPsRSu8Sxu/8 6iPgdVr1liaG7eUi3wlxPF4nUjP5Cpg13UXZuuerB5X8XkWnDptmSrplpooLflh1PX5CEIiHnSD Kq6BDcdk7BqXSvl1oSmjpq+cISKCC802bKI7Q2x2Zy57anUsoiZsdwWGs5IxGAxokvhnDku+rJP O9aZeTpSiZ0EpEHjIobUt1Zr1ETLSKgkFaRHjwPkCiibzRI5j/7cJ4OQyPbLeiq0q0HYPQXrAvZ ScB4wzw9XJe6ukL0hRwK4MB4p+Aqq3w/3G80HntJsTvoo5OvRihlXHl/RnhtpqIQJiZDA4ZxLAK C/VZydD7t2fWqjdDO8iXYnB5uWErjKFf9wI/4WHsOOpaaCkYEM984xxIR7wZdb/x5VPMA5h3pUF SiNxWEphRMEDcYeT+WGQ0l9bju5UkSG27dxACoOgtz+z0aK7/mJEO3GBCkkSdCTxz1GYqMr/Ocn QQBwW6D0PavaL X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D X-Debian-User: leitao Drop the WQ_PERCPU allocation path (alloc_and_link_percpu_pwqs()). Now that alloc_pwq() hands out the static percpu pool for a CPU and the default pwq is optional, the unbound path produces the same result. Point a percpu workqueue at it and drop alloc_and_link_percpu_pwqs(). Nothing is installed in wq->cpu_pwq when the attrs path fails, since apply_wqattrs_commit() does not run, so the enomem cleanup only has the percpu array left to free. Signed-off-by: Breno Leitao --- kernel/workqueue.c | 66 +++++++++++++-------------------------------------= ---- 1 file changed, 15 insertions(+), 51 deletions(-) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 8fac93574becb..2798a24e0c24a 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -516,6 +516,9 @@ static struct workqueue_attrs *unbound_std_wq_attrs[NR_= STD_WORKER_POOLS]; /* I: attributes used when instantiating ordered pools on demand */ static struct workqueue_attrs *ordered_wq_attrs[NR_STD_WORKER_POOLS]; =20 +/* I: attributes of percpu workqueues, which are backed by the static pool= s */ +static struct workqueue_attrs *percpu_std_wq_attrs[NR_STD_WORKER_POOLS]; + /* * I: kthread_worker to release pwq's. pwq release needs to be bounced to a * process context while holding a pool lock. Bounce to a dedicated kthread @@ -5532,7 +5535,7 @@ apply_wqattrs_prepare(struct workqueue_struct *wq, ctx->pwq_tbl[cpu] =3D ctx->dfl_pwq; } else { wq_calc_pod_cpumask(new_attrs, cpu); - ctx->pwq_tbl[cpu] =3D alloc_unbound_pwq(wq, new_attrs); + ctx->pwq_tbl[cpu] =3D alloc_pwq(wq, new_attrs, cpu); if (!ctx->pwq_tbl[cpu]) goto out_free; } @@ -5702,34 +5705,10 @@ static void unbound_wq_update_pwq(struct workqueue_= struct *wq, int cpu) put_pwq_unlocked(old_pwq); } =20 -static int alloc_and_link_percpu_pwqs(struct workqueue_struct *wq) -{ - struct pool_workqueue *pwq; - int cpu; - - for_each_possible_cpu(cpu) { - struct worker_pool *pool =3D get_percpu_pool(wq, cpu); - - pwq =3D kmem_cache_alloc_node(pwq_cache, GFP_KERNEL, pool->node); - if (!pwq) - return -ENOMEM; - - init_pwq(pwq, wq, pool); - - mutex_lock(&wq->mutex); - link_pwq(pwq); - mutex_unlock(&wq->mutex); - - rcu_assign_pointer(*per_cpu_ptr(wq->cpu_pwq, cpu), pwq); - } - - return 0; -} - static int alloc_and_link_pwqs(struct workqueue_struct *wq) { bool highpri =3D wq->flags & WQ_HIGHPRI; - int cpu, ret; + int ret; =20 lockdep_assert_held(&wq_pool_mutex); =20 @@ -5738,7 +5717,7 @@ static int alloc_and_link_pwqs(struct workqueue_struc= t *wq) goto enomem; =20 if (!(wq->flags & WQ_UNBOUND)) { - ret =3D alloc_and_link_percpu_pwqs(wq); + ret =3D apply_workqueue_attrs_locked(wq, percpu_std_wq_attrs[highpri]); } else if (wq->flags & __WQ_ORDERED) { struct pool_workqueue *dfl_pwq; =20 @@ -5757,27 +5736,8 @@ static int alloc_and_link_pwqs(struct workqueue_stru= ct *wq) return 0; =20 enomem: - if (wq->cpu_pwq) { - for_each_possible_cpu(cpu) { - struct pool_workqueue __rcu **slot; - struct pool_workqueue *pwq; - - slot =3D per_cpu_ptr(wq->cpu_pwq, cpu); - pwq =3D rcu_access_pointer(*slot); - if (pwq) { - /* - * Unlink pwq from wq->pwqs since link_pwq() - * may have already added it. wq->mutex is not - * needed as the wq has not been published yet. - */ - if (!list_empty(&pwq->pwqs_node)) - list_del_rcu(&pwq->pwqs_node); - kmem_cache_free(pwq_cache, pwq); - } - } - free_percpu(wq->cpu_pwq); - wq->cpu_pwq =3D NULL; - } + free_percpu(wq->cpu_pwq); + wq->cpu_pwq =3D NULL; return -ENOMEM; } =20 @@ -6021,10 +5981,10 @@ static struct workqueue_struct *__alloc_workqueue(c= onst char *fmt, * flushing the pwq_release_worker ensures that the pwq_release_workfn() * completes before calling kfree(wq). */ - if (wq->flags & WQ_UNBOUND) { + if (pwq_release_worker) kthread_flush_worker(pwq_release_worker); + if (wq->flags & WQ_UNBOUND) free_node_nr_active(wq->node_nr_active); - } err_free_wq: free_workqueue_attrs(wq->attrs); kfree(wq); @@ -8190,7 +8150,7 @@ void __init workqueue_init_early(void) init_cpu_worker_pool(pool, cpu, std_nice[i++]); } =20 - /* create default unbound and ordered wq attrs */ + /* create default unbound, ordered and percpu wq attrs */ for (i =3D 0; i < NR_STD_WORKER_POOLS; i++) { struct workqueue_attrs *attrs; =20 @@ -8206,6 +8166,10 @@ void __init workqueue_init_early(void) attrs->nice =3D std_nice[i]; attrs->ordered =3D true; ordered_wq_attrs[i] =3D attrs; + + BUG_ON(!(attrs =3D alloc_workqueue_attrs())); + attrs->nice =3D std_nice[i]; + percpu_std_wq_attrs[i] =3D attrs; } =20 system_wq =3D alloc_workqueue("events", WQ_PERCPU | __WQ_DEPRECATED, 0); --=20 2.53.0-Meta From nobody Mon Sep 28 18:36:21 2026 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 3E3E63B8950 for ; Wed, 19 Aug 2026 14:38:07 +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=1787150290; cv=none; b=XOnHFKwXoLrhCfNhDadvwQSDMCNObo4XzV3kafuJhyMT0HNdkL5MDSdUfaEOyfWwtinHdvLUwItNrcKsOOqperfU64LJyj2S1VANbFHuBZsTUMZvcCjYZZTGCYCg04lFwlotyahOcsmEpMmE6SACV3J6Qs9WbUA7/GBPzLQyhBA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787150290; c=relaxed/simple; bh=ctWr2B2ADQokpK6E/2N3Ey4bmlITTiyheEJZt6+b85M=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KA9vHF7K4137q4zfBFpG2eoKZdsac+JmKB9cmKDxijufYDetJlQW0Z/tzAwdANula5iKBTGINwXwiIcJ5DEeCDIi13ikEoksZ2F6ueQsiA+94h1UasNf45C2KikzlYO0Uxb1REZ+ReFVfOPB1KBXnF46j/VKHaetOpxE9mdfv8s= 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=TDdzuIwt; 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="TDdzuIwt" 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:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description; bh=zPZf1TydnlCkjDgw6ugRO1QIEl3UWf/OW9/yHbOJkV0=; b=TDdzuIwtdt5y3c/+g/WSWzJoxD TrhVjufRDayP98KhKKc2Ut4tyQdITnP5cMHtnnRLAZpBmgfIuPYpxfLHxNYbAZYZMF9luMqg6oRkV 7w+0cGCIcw4nQfPvsCmdxdBpxAcz17QbyYKbM5hFReX+2R117+pi9kzB02k83eJ+4O8oGQzvIMiuc bHE5fgOeD8CBJWaVjTvhN0KHdPnrPWftnaGl9OKfyGkaM1eLuq510YayPvB3rXeN8VM00iB/VBqTv TqXUTvpvO/IR7MYBRaYAO02t16sP7EpA0hOlW8SsRjSacpG+BI6V5tOVBJ2NbdeoRwJOZhn1pPhsQ Al6nAFAg==; 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 1wwhQZ-009rNP-1O; Wed, 19 Aug 2026 14:38:03 +0000 From: Breno Leitao Date: Wed, 19 Aug 2026 07:37:39 -0700 Subject: [PATCH 5/5] workqueue: rename the pwq slot helpers shared with percpu 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: quoted-printable Message-Id: <20260819-wq_realsplit-v1-5-6ad3c3f48be8@debian.org> References: <20260819-wq_realsplit-v1-0-6ad3c3f48be8@debian.org> In-Reply-To: <20260819-wq_realsplit-v1-0-6ad3c3f48be8@debian.org> To: Tejun Heo , Lai Jiangshan Cc: linux-kernel@vger.kernel.org, pmladek@suse.com, marco.crivellari@suse.com, gustavold@gmail.com, david.dai@linux.dev, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.16-dev-f8e9d X-Developer-Signature: v=1; a=openpgp-sha256; l=4704; i=leitao@debian.org; h=from:subject:message-id; bh=ctWr2B2ADQokpK6E/2N3Ey4bmlITTiyheEJZt6+b85M=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBqhb+0odkBXWmrfa98AOjuUlLWYqNX4euZNM0Ra KH1XVYQaoKJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCaoW/tAAKCRA1o5Of/Hh3 bRe4EACxIMRwju67ktlohO7ISRvs5E/BFTmL4saoS7S3GIvI63BWG4wGRawdBoXpt8xEWTisAkd f7fv3+S+ueld3WNFpmdsFGp++R0URDsixdif88kucGgbvYd7RX+9Vfs2Y0Io9ecJur19JjD/vke jlGEXEsBdhvcKVv8AZq4L1pHaoOxBxkf5GMnH2bR2NWY5l2Kkc/gcLUGhUOfNv1jpsg2/2U4/a0 Q83JBGGDFsKEtnA+I7jG/E4neEe3gIEXBXXctrhzUj751l7PMqvnFLfpqGpXixuDk5bGf0Hnvhu dRaCsLSQ6DOpQe1ydQpOxpVcPwCWkHksi8bPbHFRyDnQ3O5geavK15BIsZGViNFEvBZLWdV810D RBxW9DiJkbuId6xfRAW+D8AgHdX1O0pX1lT5lusR5XLGFspRWJAm3mLmoloWM76m5ffUohGz7K7 PyyCMj0yFjfk0bB8+x56eE16jfOztqu4iKKLv0+cDVrLQ36poxry7aeWm7mLBKw/r4gUiCq4d1K 11p6zeltHLDfYBe8gmTP03ryw6Rx614RAaIBiL42N8nMypN6KZdK+VVBpBZCNU5gqJmPF4Yzxcv 3AAAJhImOgJPwxjibASuwnBkW2nbiCgWJr7feQu2UdtuIusSNQVVsT8NwVbMbFyjgqD7Zyy8Wk4 570awltpkh7Iuag== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D X-Debian-User: leitao install_unbound_pwq() fills the pwq slots of a percpu workqueue as well now that alloc_and_link_pwqs() sends it through the attrs path, and unbound_pwq_slot() and unbound_pwq() have always addressed and read those slots for every workqueue, percpu included, from destroy_workqueue(). Their names say otherwise. Rename them to install_pwq(), pwq_slot() and installed_pwq(). Signed-off-by: Breno Leitao --- kernel/workqueue.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 2798a24e0c24a..3127ea9d0a422 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -742,7 +742,7 @@ static int worker_pool_assign_id(struct worker_pool *po= ol) } =20 static struct pool_workqueue __rcu ** -unbound_pwq_slot(struct workqueue_struct *wq, int cpu) +pwq_slot(struct workqueue_struct *wq, int cpu) { if (cpu >=3D 0) return per_cpu_ptr(wq->cpu_pwq, cpu); @@ -751,9 +751,9 @@ unbound_pwq_slot(struct workqueue_struct *wq, int cpu) } =20 /* @cpu < 0 for dfl_pwq */ -static struct pool_workqueue *unbound_pwq(struct workqueue_struct *wq, int= cpu) +static struct pool_workqueue *installed_pwq(struct workqueue_struct *wq, i= nt cpu) { - return rcu_dereference_check(*unbound_pwq_slot(wq, cpu), + return rcu_dereference_check(*pwq_slot(wq, cpu), lockdep_is_held(&wq_pool_mutex) || lockdep_is_held(&wq->mutex)); } @@ -768,7 +768,7 @@ static struct pool_workqueue *unbound_pwq(struct workqu= eue_struct *wq, int cpu) */ static struct cpumask *unbound_effective_cpumask(struct workqueue_struct *= wq) { - return unbound_pwq(wq, -1)->pool->attrs->__pod_cpumask; + return installed_pwq(wq, -1)->pool->attrs->__pod_cpumask; } =20 static unsigned int work_color_to_flags(int color) @@ -5450,10 +5450,10 @@ static void wq_calc_pod_cpumask(struct workqueue_at= trs *attrs, int cpu) } =20 /* install @pwq into @wq and return the old pwq, @cpu < 0 for dfl_pwq */ -static struct pool_workqueue *install_unbound_pwq(struct workqueue_struct = *wq, - int cpu, struct pool_workqueue *pwq) +static struct pool_workqueue *install_pwq(struct workqueue_struct *wq, + int cpu, struct pool_workqueue *pwq) { - struct pool_workqueue __rcu **slot =3D unbound_pwq_slot(wq, cpu); + struct pool_workqueue __rcu **slot =3D pwq_slot(wq, cpu); struct pool_workqueue *old_pwq; =20 lockdep_assert_held(&wq_pool_mutex); @@ -5577,10 +5577,10 @@ static void apply_wqattrs_commit(struct apply_wqatt= rs_ctx *ctx) =20 /* save the previous pwqs and install the new ones */ for_each_possible_cpu(cpu) - ctx->pwq_tbl[cpu] =3D install_unbound_pwq(ctx->wq, cpu, - ctx->pwq_tbl[cpu]); + ctx->pwq_tbl[cpu] =3D install_pwq(ctx->wq, cpu, + ctx->pwq_tbl[cpu]); if (ctx->dfl_pwq) - ctx->dfl_pwq =3D install_unbound_pwq(ctx->wq, -1, ctx->dfl_pwq); + ctx->dfl_pwq =3D install_pwq(ctx->wq, -1, ctx->dfl_pwq); =20 /* update node_nr_active->max, which only unbound workqueues have */ if (ctx->wq->flags & WQ_UNBOUND) @@ -5677,7 +5677,7 @@ static void unbound_wq_update_pwq(struct workqueue_st= ruct *wq, int cpu) =20 /* nothing to do if the target cpumask matches the current pwq */ wq_calc_pod_cpumask(target_attrs, cpu); - if (wqattrs_equal(target_attrs, unbound_pwq(wq, cpu)->pool->attrs)) + if (wqattrs_equal(target_attrs, installed_pwq(wq, cpu)->pool->attrs)) return; =20 /* create a new pwq */ @@ -5690,16 +5690,16 @@ static void unbound_wq_update_pwq(struct workqueue_= struct *wq, int cpu) =20 /* Install the new pwq. */ mutex_lock(&wq->mutex); - old_pwq =3D install_unbound_pwq(wq, cpu, pwq); + old_pwq =3D install_pwq(wq, cpu, pwq); goto out_unlock; =20 use_dfl_pwq: mutex_lock(&wq->mutex); - pwq =3D unbound_pwq(wq, -1); + pwq =3D installed_pwq(wq, -1); raw_spin_lock_irq(&pwq->pool->lock); get_pwq(pwq); raw_spin_unlock_irq(&pwq->pool->lock); - old_pwq =3D install_unbound_pwq(wq, cpu, pwq); + old_pwq =3D install_pwq(wq, cpu, pwq); out_unlock: mutex_unlock(&wq->mutex); put_pwq_unlocked(old_pwq); @@ -6173,12 +6173,12 @@ void destroy_workqueue(struct workqueue_struct *wq) rcu_read_lock(); =20 for_each_possible_cpu(cpu) { - put_pwq_unlocked(unbound_pwq(wq, cpu)); - RCU_INIT_POINTER(*unbound_pwq_slot(wq, cpu), NULL); + put_pwq_unlocked(installed_pwq(wq, cpu)); + RCU_INIT_POINTER(*pwq_slot(wq, cpu), NULL); } =20 - put_pwq_unlocked(unbound_pwq(wq, -1)); - RCU_INIT_POINTER(*unbound_pwq_slot(wq, -1), NULL); + put_pwq_unlocked(installed_pwq(wq, -1)); + RCU_INIT_POINTER(*pwq_slot(wq, -1), NULL); =20 rcu_read_unlock(); } --=20 2.53.0-Meta