Received: by 10.223.176.5 with SMTP id f5csp199659wra; Fri, 26 Jan 2018 21:12:44 -0800 (PST) X-Google-Smtp-Source: AH8x224jaG3EXgoly+dsJl14VlIOAMbtdFg6t1bIM+5j5UD0USxoLAigxoXocFdsfe7D4IClMXOt X-Received: by 2002:a17:902:9683:: with SMTP id n3-v6mr15708542plp.177.1517029964693; Fri, 26 Jan 2018 21:12:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517029964; cv=none; d=google.com; s=arc-20160816; b=Kw3h/vRLkE2iTdQIygpBmKD3iGjuPllPnrNsXyiuu7xs0eUQaQtEI37S9HlLCceJRa FPiNIwv5ovHzil9sZ8js8x+wK2C73sGkqwcg4nHZD0/IJuJt5xT1AlYAbrRWyf/vWohb L9Cebz68hQwPVKpuqE3tNiUpIgEht5cX8wlz6/Pb2mGy3o2Ek2zK8b0nhKsqWq6t3CzC 9BNeb/3HEHexTwy7XSY8mK9hw6YQuG10uSdVipevNV4fPKDy1hYCwTgbAWHaH2z9n1hL SiCsZdtI8GprVa+8VH0lfqKIoJV1YhLdirdJuL6yIexejuTvhDNdYcCyzFjc/rZAdJW0 6TMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=VABHWmXcYAQOYdvaJgxl3eoeXgYBhk7Euwyivf/Twek=; b=Fv46ti1swuOa3e1XU0TdOKnMHuIidjJosYSIhBQP8hcnx/umXOhFRKsHpCXDwGdbx1 zF5t/tgtOzJGLNHrNu8qe7hhnCojYFfIUS4DqCkMQq1JjINY5BQKuz8cUVy6aOKCFZ4v h6AWhR/ai/G713NmLoq4PmlZ6LrssStPVAEFWsDhe1iaFKbmXIp4QKuvd1qJ1TK0OPAe WO6zCRJ1EJCZXdmN/S41+kNu18fJlHY7IzfT3j5l2RQvV4lsYLRlkV3KotaAV2o4kWIB 2vbV6YMk+Jkih/gc6o9Vjq39WLT7P7+7BBOKszu6G6ZhHTMT2jL3X+b5cqRuWEx2albP w3PA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o12si3993289pgq.9.2018.01.26.21.12.30; Fri, 26 Jan 2018 21:12:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751997AbeA0FLO (ORCPT + 99 others); Sat, 27 Jan 2018 00:11:14 -0500 Received: from out1.zte.com.cn ([202.103.147.172]:43430 "EHLO mxct.zte.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751198AbeA0FKe (ORCPT ); Sat, 27 Jan 2018 00:10:34 -0500 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id E2949DAF45C332B7E416; Sat, 27 Jan 2018 13:10:30 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id w0R59uoZ092779; Sat, 27 Jan 2018 13:09:56 +0800 (GMT-8) (envelope-from wen.yang99@zte.com.cn) Received: from localhost.localdomain ([10.75.9.60]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2018012713100629-2795349 ; Sat, 27 Jan 2018 13:10:06 +0800 From: Wen Yang To: tj@kernel.org Cc: zhong.weidong@zte.com.cn, wen.yang99@zte.com.cn, Jiang Biao , Tan Hu , Lai Jiangshan , kernel test robot , linux-kernel@vger.kernel.org Subject: [RFC PATCH V5 3/5] workqueue: rename unbound_attrs to attrs Date: Sat, 27 Jan 2018 13:15:25 +0800 Message-Id: <1517030127-21391-3-git-send-email-wen.yang99@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1517030127-21391-1-git-send-email-wen.yang99@zte.com.cn> References: <1517030127-21391-1-git-send-email-wen.yang99@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2018-01-27 13:10:06, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2018-01-27 13:09:36, Serialize complete at 2018-01-27 13:09:36 X-MAIL: mse01.zte.com.cn w0R59uoZ092779 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Replace workqueue's unbound_attrs by attrs, so that both unbound or bound wq can use it. Signed-off-by: Wen Yang Signed-off-by: Jiang Biao Signed-off-by: Tan Hu Suggested-by: Tejun Heo Cc: Tejun Heo Cc: Lai Jiangshan Cc: kernel test robot Cc: linux-kernel@vger.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