Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752221AbdIFDvL (ORCPT ); Tue, 5 Sep 2017 23:51:11 -0400 Received: from sender-pp-091.zoho.com ([135.84.80.236]:25033 "EHLO sender-pp-091.zoho.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751356AbdIFDvK (ORCPT ); Tue, 5 Sep 2017 23:51:10 -0400 X-Greylist: delayed 910 seconds by postgrey-1.27 at vger.kernel.org; Tue, 05 Sep 2017 23:51:10 EDT DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=zapps768; d=zoho.com; h=cc:to:from:subject:message-id:date:user-agent:mime-version:content-type; b=hseIedwP5NtTz9MUmC54SUPOxeJgZnO7BZ5DOD0Rx1LEmNdXUJIYVzunnwHocLE+k03r9x7c9Bhp x+w4X9XnQc9/7a6BA4ZZZHt5nv3zXbjQ/w5aNtI55VaBNheHrPEE Cc: linux-kernel@vger.kernel.org, zijun_hu@htc.com To: tj@kernel.org, Andrew Morton , jiangshanlai@gmail.com From: zijun_hu Subject: [PATCH 1/1] workqueue: use type int instead of bool to index array Message-ID: <59AF6CB6.4090609@zoho.com> Date: Wed, 6 Sep 2017 11:34:14 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-ZohoMailClient: External Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1775 Lines: 54 From: zijun_hu type bool is used to index three arrays in alloc_and_link_pwqs() it doesn't look like conventional. it is fixed by using type int to index the relevant arrays. Signed-off-by: zijun_hu --- kernel/workqueue.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index ab3c0dc8c7ed..0c7a16792949 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -3917,7 +3917,7 @@ static void wq_update_unbound_numa(struct workqueue_struct *wq, int cpu, static int alloc_and_link_pwqs(struct workqueue_struct *wq) { - bool highpri = wq->flags & WQ_HIGHPRI; + int pool_idx = (wq->flags & WQ_HIGHPRI) ? 1 : 0; int cpu, ret; if (!(wq->flags & WQ_UNBOUND)) { @@ -3931,7 +3931,7 @@ static int alloc_and_link_pwqs(struct workqueue_struct *wq) struct worker_pool *cpu_pools = per_cpu(cpu_worker_pools, cpu); - init_pwq(pwq, wq, &cpu_pools[highpri]); + init_pwq(pwq, wq, &cpu_pools[pool_idx]); mutex_lock(&wq->mutex); link_pwq(pwq); @@ -3939,14 +3939,15 @@ static int alloc_and_link_pwqs(struct workqueue_struct *wq) } return 0; } else if (wq->flags & __WQ_ORDERED) { - ret = apply_workqueue_attrs(wq, ordered_wq_attrs[highpri]); + ret = apply_workqueue_attrs(wq, ordered_wq_attrs[pool_idx]); /* there should only be single pwq for ordering guarantee */ WARN(!ret && (wq->pwqs.next != &wq->dfl_pwq->pwqs_node || wq->pwqs.prev != &wq->dfl_pwq->pwqs_node), "ordering guarantee broken for workqueue %s\n", wq->name); return ret; } else { - return apply_workqueue_attrs(wq, unbound_std_wq_attrs[highpri]); + return apply_workqueue_attrs(wq, + unbound_std_wq_attrs[pool_idx]); } } -- 1.9.1