From: Breno Leitao <leitao@debian.org>
To: Tejun Heo <tj@kernel.org>, Lai Jiangshan <jiangshanlai@gmail.com>
Cc: linux-kernel@vger.kernel.org, marco.crivellari@suse.com,
Breno Leitao <leitao@debian.org>,
kernel-team@meta.com
Subject: [PATCH v2 6/9] workqueue: rename wq->unbound_attrs to wq->attrs
Date: Wed, 05 Aug 2026 07:52:33 -0700 [thread overview]
Message-ID: <20260805-wq-pool-refactor-v2-6-fd498d01d695@debian.org> (raw)
In-Reply-To: <20260805-wq-pool-refactor-v2-0-fd498d01d695@debian.org>
The unbound prefix says which workqueues currently have the field rather
than what it holds, and the next patch allocates it for every workqueue.
Rename it first so that change stays a single line.
tools/workqueue/wq_dump.py reads the field by name, so rename it there
too.
wq_sysfs_unbound_attrs[] keeps its name: it is the set of sysfs files
that only unbound workqueues expose.
No functional change.
Signed-off-by: Breno Leitao <leitao@debian.org>
---
kernel/workqueue.c | 38 +++++++++++++++++++-------------------
tools/workqueue/wq_dump.py | 6 +++---
2 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index b6458ee53852f..fbe13c9be4c28 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -371,7 +371,7 @@ struct workqueue_struct {
int saved_max_active; /* WQ: saved max_active */
int saved_min_active; /* WQ: saved min_active */
- struct workqueue_attrs *unbound_attrs; /* PW: only for unbound wqs */
+ struct workqueue_attrs *attrs; /* PW: workqueue attributes */
struct pool_workqueue __rcu *dfl_pwq; /* PW: only for unbound wqs */
#ifdef CONFIG_SYSFS
@@ -759,7 +759,7 @@ static struct pool_workqueue *unbound_pwq(struct workqueue_struct *wq, int cpu)
* unbound_effective_cpumask - effective cpumask of an unbound workqueue
* @wq: workqueue of interest
*
- * @wq->unbound_attrs->cpumask contains the cpumask requested by the user which
+ * @wq->attrs->cpumask contains the cpumask requested by the user which
* is masked with wq_unbound_cpumask to determine the effective cpumask. The
* default pwq is always mapped to the pool with the current effective cpumask.
*/
@@ -5098,7 +5098,7 @@ static void rcu_free_wq(struct rcu_head *rcu)
wq_free_lockdep(wq);
free_percpu(wq->cpu_pwq);
- free_workqueue_attrs(wq->unbound_attrs);
+ free_workqueue_attrs(wq->attrs);
kfree(wq);
}
@@ -5548,7 +5548,7 @@ static void apply_wqattrs_commit(struct apply_wqattrs_ctx *ctx)
/* all pwqs have been created successfully, let's install'em */
mutex_lock(&ctx->wq->mutex);
- copy_workqueue_attrs(ctx->wq->unbound_attrs, ctx->attrs);
+ copy_workqueue_attrs(ctx->wq->attrs, ctx->attrs);
/* save the previous pwqs and install the new ones */
for_each_possible_cpu(cpu)
@@ -5635,7 +5635,7 @@ static void unbound_wq_update_pwq(struct workqueue_struct *wq, int cpu)
lockdep_assert_held(&wq_pool_mutex);
- if (!(wq->flags & WQ_UNBOUND) || wq->unbound_attrs->ordered)
+ if (!(wq->flags & WQ_UNBOUND) || wq->attrs->ordered)
return;
/*
@@ -5645,7 +5645,7 @@ static void unbound_wq_update_pwq(struct workqueue_struct *wq, int cpu)
*/
target_attrs = unbound_wq_update_pwq_attrs_buf;
- copy_workqueue_attrs(target_attrs, wq->unbound_attrs);
+ copy_workqueue_attrs(target_attrs, wq->attrs);
wqattrs_actualize_cpumask(target_attrs, wq_unbound_cpumask);
/* nothing to do if the target cpumask matches the current pwq */
@@ -5903,8 +5903,8 @@ static struct workqueue_struct *__alloc_workqueue(const char *fmt,
return NULL;
if (flags & WQ_UNBOUND) {
- wq->unbound_attrs = alloc_workqueue_attrs_noprof();
- if (!wq->unbound_attrs)
+ wq->attrs = alloc_workqueue_attrs_noprof();
+ if (!wq->attrs)
goto err_free_wq;
}
@@ -5999,7 +5999,7 @@ static struct workqueue_struct *__alloc_workqueue(const char *fmt,
free_node_nr_active(wq->node_nr_active);
}
err_free_wq:
- free_workqueue_attrs(wq->unbound_attrs);
+ free_workqueue_attrs(wq->attrs);
kfree(wq);
return NULL;
err_unlock_destroy:
@@ -6943,7 +6943,7 @@ int workqueue_online_cpu(unsigned int cpu)
/* update pod affinity of unbound workqueues */
list_for_each_entry(wq, &workqueues, list) {
- struct workqueue_attrs *attrs = wq->unbound_attrs;
+ struct workqueue_attrs *attrs = wq->attrs;
if (wq->flags & WQ_UNBOUND) {
const struct wq_pod_type *pt = wqattrs_pod_type(attrs);
@@ -6978,7 +6978,7 @@ int workqueue_offline_cpu(unsigned int cpu)
cpumask_clear_cpu(cpu, wq_online_cpumask);
list_for_each_entry(wq, &workqueues, list) {
- struct workqueue_attrs *attrs = wq->unbound_attrs;
+ struct workqueue_attrs *attrs = wq->attrs;
if (wq->flags & WQ_UNBOUND) {
const struct wq_pod_type *pt = wqattrs_pod_type(attrs);
@@ -7158,7 +7158,7 @@ static int workqueue_apply_unbound_cpumask(const cpumask_var_t unbound_cpumask)
if (!(wq->flags & WQ_UNBOUND) || (wq->flags & __WQ_DESTROYING))
continue;
- ctx = apply_wqattrs_prepare(wq, wq->unbound_attrs, unbound_cpumask);
+ ctx = apply_wqattrs_prepare(wq, wq->attrs, unbound_cpumask);
if (IS_ERR(ctx)) {
ret = PTR_ERR(ctx);
break;
@@ -7376,7 +7376,7 @@ static ssize_t wq_nice_show(struct device *dev, struct device_attribute *attr,
int written;
mutex_lock(&wq->mutex);
- written = scnprintf(buf, PAGE_SIZE, "%d\n", wq->unbound_attrs->nice);
+ written = scnprintf(buf, PAGE_SIZE, "%d\n", wq->attrs->nice);
mutex_unlock(&wq->mutex);
return written;
@@ -7393,7 +7393,7 @@ static struct workqueue_attrs *wq_sysfs_prep_attrs(struct workqueue_struct *wq)
if (!attrs)
return NULL;
- copy_workqueue_attrs(attrs, wq->unbound_attrs);
+ copy_workqueue_attrs(attrs, wq->attrs);
return attrs;
}
@@ -7430,7 +7430,7 @@ static ssize_t wq_cpumask_show(struct device *dev,
mutex_lock(&wq->mutex);
written = scnprintf(buf, PAGE_SIZE, "%*pb\n",
- cpumask_pr_args(wq->unbound_attrs->cpumask));
+ cpumask_pr_args(wq->attrs->cpumask));
mutex_unlock(&wq->mutex);
return written;
}
@@ -7466,13 +7466,13 @@ static ssize_t wq_affn_scope_show(struct device *dev,
int written;
mutex_lock(&wq->mutex);
- if (wq->unbound_attrs->affn_scope == WQ_AFFN_DFL)
+ if (wq->attrs->affn_scope == WQ_AFFN_DFL)
written = scnprintf(buf, PAGE_SIZE, "%s (%s)\n",
wq_affn_names[WQ_AFFN_DFL],
wq_affn_names[wq_affn_dfl]);
else
written = scnprintf(buf, PAGE_SIZE, "%s\n",
- wq_affn_names[wq->unbound_attrs->affn_scope]);
+ wq_affn_names[wq->attrs->affn_scope]);
mutex_unlock(&wq->mutex);
return written;
@@ -7507,7 +7507,7 @@ static ssize_t wq_affinity_strict_show(struct device *dev,
struct workqueue_struct *wq = dev_to_wq(dev);
return scnprintf(buf, PAGE_SIZE, "%d\n",
- wq->unbound_attrs->affn_strict);
+ wq->attrs->affn_strict);
}
static ssize_t wq_affinity_strict_store(struct device *dev,
@@ -7680,7 +7680,7 @@ int workqueue_sysfs_register(struct workqueue_struct *wq)
dev_set_name(&wq_dev->dev, "%s", wq->name);
/*
- * unbound_attrs are created separately. Suppress uevent until
+ * attrs are created separately. Suppress uevent until
* everything is ready.
*/
dev_set_uevent_suppress(&wq_dev->dev, true);
diff --git a/tools/workqueue/wq_dump.py b/tools/workqueue/wq_dump.py
index a0c72237531f9..e0a6936a2a37f 100644
--- a/tools/workqueue/wq_dump.py
+++ b/tools/workqueue/wq_dump.py
@@ -85,7 +85,7 @@ def wq_type_str(wq):
if wq.flags & WQ_ORDERED:
return f'{"ordered":{wq_type_len}}'
else:
- if wq.unbound_attrs.affn_strict:
+ if wq.attrs.affn_strict:
return f'{"unbound,S":{wq_type_len}}'
else:
return f'{"unbound":{wq_type_len}}'
@@ -205,8 +205,8 @@ for wq in list_for_each_entry('struct workqueue_struct', workqueues.address_of_(
continue
print(f'{wq.name.string_().decode():{WQ_NAME_LEN}}', end='')
- if wq.unbound_attrs.value_() != 0:
- print(f' {cpumask_str(wq.unbound_attrs.cpumask):{ucpus_len}}', end='')
+ if wq.attrs.value_() != 0:
+ print(f' {cpumask_str(wq.attrs.cpumask):{ucpus_len}}', end='')
else:
print(f' {"":{ucpus_len}}', end='')
--
2.53.0-Meta
next prev parent reply other threads:[~2026-08-05 14:53 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-05 14:52 [PATCH v2 0/9] workqueue: base pwq pool release and nr_active on the backing pool Breno Leitao
2026-08-05 14:52 ` [PATCH v2 1/9] workqueue: factor out get_percpu_pool() Breno Leitao
2026-08-05 14:52 ` [PATCH v2 2/9] workqueue: factor out alloc_and_link_percpu_pwqs() Breno Leitao
2026-08-05 14:52 ` [PATCH v2 3/9] workqueue: release pwq pools by pool type Breno Leitao
2026-08-05 14:52 ` [PATCH v2 4/9] workqueue: account nr_active by the backing pool Breno Leitao
2026-08-10 21:41 ` Tejun Heo
2026-08-11 10:15 ` Breno Leitao
2026-08-05 14:52 ` [PATCH v2 5/9] workqueue: test WQ_UNBOUND explicitly in the hotplug loops Breno Leitao
2026-08-05 14:52 ` Breno Leitao [this message]
2026-08-05 14:52 ` [PATCH v2 7/9] workqueue: allocate attrs for all workqueues Breno Leitao
2026-08-05 14:52 ` [PATCH v2 8/9] workqueue: rename alloc_unbound_pwq() to alloc_pwq() Breno Leitao
2026-08-05 14:52 ` [PATCH v2 9/9] workqueue: skip the node_nr_active update for non-unbound workqueues Breno Leitao
2026-08-10 22:10 ` [PATCH v2 0/9] workqueue: base pwq pool release and nr_active on the backing pool Tejun Heo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260805-wq-pool-refactor-v2-6-fd498d01d695@debian.org \
--to=leitao@debian.org \
--cc=jiangshanlai@gmail.com \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marco.crivellari@suse.com \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.