[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1517030127-21391-3-git-send-email-wen.yang99@zte.com.cn>
Date: Sat, 27 Jan 2018 13:15:25 +0800
From: Wen Yang <wen.yang99@....com.cn>
To: tj@...nel.org
Cc: zhong.weidong@....com.cn, wen.yang99@....com.cn,
Jiang Biao <jiang.biao2@....com.cn>,
Tan Hu <tan.hu@....com.cn>,
Lai Jiangshan <jiangshanlai@...il.com>,
kernel test robot <xiaolong.ye@...el.com>,
linux-kernel@...r.kernel.org
Subject: [RFC PATCH V5 3/5] workqueue: rename unbound_attrs to attrs
Replace workqueue's unbound_attrs by attrs, so that both unbound
or bound wq can use it.
Signed-off-by: Wen Yang <wen.yang99@....com.cn>
Signed-off-by: Jiang Biao <jiang.biao2@....com.cn>
Signed-off-by: Tan Hu <tan.hu@....com.cn>
Suggested-by: Tejun Heo <tj@...nel.org>
Cc: Tejun Heo <tj@...nel.org>
Cc: Lai Jiangshan <jiangshanlai@...il.com>
Cc: kernel test robot <xiaolong.ye@...el.com>
Cc: linux-kernel@...r.kernel.org
---
kernel/workqueue.c | 31 ++++++++++++++-----------------
1 file changed, 14 insertions(+), 17 deletions(-)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index d5a5c76..df22ecb 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -255,7 +255,7 @@ struct workqueue_struct {
int nr_drainers; /* WQ: drain in progress */
int saved_max_active; /* WQ: saved pwq max_active */
- struct workqueue_attrs *unbound_attrs; /* PW: only for unbound wqs */
+ struct workqueue_attrs *attrs;
struct pool_workqueue *dfl_pwq; /* PW: only for unbound wqs */
#ifdef CONFIG_SYSFS
@@ -3248,9 +3248,8 @@ static void rcu_free_wq(struct rcu_head *rcu)
if (!(wq->flags & WQ_UNBOUND))
free_percpu(wq->cpu_pwqs);
- else
- free_workqueue_attrs(wq->unbound_attrs);
+ free_workqueue_attrs(wq->attrs);
kfree(wq->rescuer);
kfree(wq);
}
@@ -3725,7 +3724,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 pwq and install the new one */
for_each_node(node)
@@ -3842,7 +3841,7 @@ static void wq_update_unbound_numa(struct workqueue_struct *wq, int cpu,
lockdep_assert_held(&wq_pool_mutex);
if (!wq_numa_enabled || !(wq->flags & WQ_UNBOUND) ||
- wq->unbound_attrs->no_numa)
+ wq->attrs->no_numa)
return;
/*
@@ -3853,7 +3852,7 @@ static void wq_update_unbound_numa(struct workqueue_struct *wq, int cpu,
target_attrs = wq_update_unbound_numa_attrs_buf;
cpumask = target_attrs->cpumask;
- copy_workqueue_attrs(target_attrs, wq->unbound_attrs);
+ copy_workqueue_attrs(target_attrs, wq->attrs);
pwq = unbound_pwq_by_node(wq, node);
/*
@@ -3973,11 +3972,9 @@ struct workqueue_struct *__alloc_workqueue_key(const char *fmt,
if (!wq)
return NULL;
- if (flags & WQ_UNBOUND) {
- wq->unbound_attrs = alloc_workqueue_attrs(GFP_KERNEL);
- if (!wq->unbound_attrs)
- goto err_free_wq;
- }
+ wq->attrs = alloc_workqueue_attrs(GFP_KERNEL);
+ if (!wq->attrs)
+ goto err_free_wq;
va_start(args, lock_name);
vsnprintf(wq->name, sizeof(wq->name), fmt, args);
@@ -4048,7 +4045,7 @@ struct workqueue_struct *__alloc_workqueue_key(const char *fmt,
return wq;
err_free_wq:
- free_workqueue_attrs(wq->unbound_attrs);
+ free_workqueue_attrs(wq->attrs);
kfree(wq);
return NULL;
err_destroy:
@@ -4919,7 +4916,7 @@ static int workqueue_apply_unbound_cpumask(void)
if (wq->flags & __WQ_ORDERED)
continue;
- ctx = apply_wqattrs_prepare(wq, wq->unbound_attrs);
+ ctx = apply_wqattrs_prepare(wq, wq->attrs);
if (!ctx) {
ret = -ENOMEM;
break;
@@ -5077,7 +5074,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;
@@ -5094,7 +5091,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;
}
@@ -5131,7 +5128,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;
}
@@ -5168,7 +5165,7 @@ static ssize_t wq_numa_show(struct device *dev, struct device_attribute *attr,
mutex_lock(&wq->mutex);
written = scnprintf(buf, PAGE_SIZE, "%d\n",
- !wq->unbound_attrs->no_numa);
+ !wq->attrs->no_numa);
mutex_unlock(&wq->mutex);
return written;
--
1.8.3.1
Powered by blists - more mailing lists