Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3448153imm; Tue, 29 May 2018 07:26:31 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr1i9MEqKu6NfVp7+Ih/2vW4RWinpwMuDQroe6Ahn8CpxCfm30L9ivkQrWol7GDOa6jELPA X-Received: by 2002:a17:902:868b:: with SMTP id g11-v6mr17484544plo.305.1527603991067; Tue, 29 May 2018 07:26:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527603991; cv=none; d=google.com; s=arc-20160816; b=AFxuBXQt2izkNgFf1i15IdKKmkyc/WUO1iEm7d83KR+q3M2cZwocpTRiFLETsUAHOT kaT/wqjD1T9ie/euDlC5A02wWqN5qg2WINagcrAXINosDP2OdHbtoG581e4hJEN1m8QT PzoNv3v7RUQsF64IwEJZjhfJsjJLdlf1MB7G8Lf8CpJzD8eK5Kp2Z+nyzTdCxGpgiGqi CXPS98q6NRw580S4zU8GKKukfSO15rTPgA6QphRMgELdzpdNvzY1D07ggS0iaZE9Vwx+ UCDVWl1ZDqWrM6j5n5mf2jvXMEf5Erf8VN5Rd8Ln8xSmwW5GdH/tIhfRJeBqmTgQlJvi FoJA== 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=jVMPTw8vq6ScDZLmysfIKO3xYep89mwNhjRLKRt0/NA=; b=f6X/QVX0VmYDB+9czpiUOE1Ox41NuVHZT0RLtUx8Hj8FdeeD9I4uB62Up0RryZ9YQ/ ZwmTsYNQBO5H4PrGtCpVB9vXDLOkIa2LP8A7EsBSD5oVWUfVi6LEAhgeYEkCMCMpLyWF cZqpgpNbw0NlHUrvFoVd9E9idZ0dR/PKFl6Le5z8ceda1hKSDZyEvugHgasuF/bSX/lB 3kwz2TUhrGDZMFAu/mDZxTAe+40Gj+H/fgitJOX0usMt3HsqcieKbmAx5zBBhUN1EYKl BNk9DBCGbSZimdy6RaUuLj07Yqh6VsvoqFHxzB+t8K4L+z2iBH7CSuIzyjqwTAzZ0J/W w2ZA== 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 m15-v6si25661094pgu.352.2018.05.29.07.26.17; Tue, 29 May 2018 07:26:31 -0700 (PDT) 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 S935294AbeE2OWl (ORCPT + 99 others); Tue, 29 May 2018 10:22:41 -0400 Received: from smtp4.ccs.ornl.gov ([160.91.203.40]:38208 "EHLO smtp4.ccs.ornl.gov" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935249AbeE2OWd (ORCPT ); Tue, 29 May 2018 10:22:33 -0400 Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp4.ccs.ornl.gov (Postfix) with ESMTP id F077D10052D1; Tue, 29 May 2018 10:22:06 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id EEC9CBF; Tue, 29 May 2018 10:22:06 -0400 (EDT) From: James Simmons To: Greg Kroah-Hartman , devel@driverdev.osuosl.org, Andreas Dilger , Oleg Drokin , NeilBrown Cc: Linux Kernel Mailing List , Lustre Development List , Dmitry Eremin , James Simmons Subject: [PATCH v2 17/25] staging: lustre: libcfs: rename cpumask_var_t variables to *_mask Date: Tue, 29 May 2018 10:21:57 -0400 Message-Id: <1527603725-30560-18-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1527603725-30560-1-git-send-email-jsimmons@infradead.org> References: <1527603725-30560-1-git-send-email-jsimmons@infradead.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dmitry Eremin Because we handle both cpu mask as well as core identifiers it can easily be confused. To avoid this rename various cpumask_var_t to have appended *_mask to their names. Signed-off-by: Dmitry Eremin Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8703 Reviewed-on: https://review.whamcloud.com/23222 Reviewed-by: Amir Shehata Reviewed-by: James Simmons Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- Changelog: v1) Initial patch v2) Rebased patch. No changes in code from earlier patch drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c | 62 ++++++++++++------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c b/drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c index 1c10529..fb27dac 100644 --- a/drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c +++ b/drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c @@ -710,23 +710,23 @@ int cfs_cpt_bind(struct cfs_cpt_table *cptab, int cpt) * We always prefer to choose CPU in the same core/socket. */ static int cfs_cpt_choose_ncpus(struct cfs_cpt_table *cptab, int cpt, - cpumask_t *node, int number) + cpumask_t *node_mask, int number) { - cpumask_var_t socket; - cpumask_var_t core; + cpumask_var_t socket_mask; + cpumask_var_t core_mask; int rc = 0; int cpu; LASSERT(number > 0); - if (number >= cpumask_weight(node)) { - while (!cpumask_empty(node)) { - cpu = cpumask_first(node); + if (number >= cpumask_weight(node_mask)) { + while (!cpumask_empty(node_mask)) { + cpu = cpumask_first(node_mask); rc = cfs_cpt_set_cpu(cptab, cpt, cpu); if (!rc) return -EINVAL; - cpumask_clear_cpu(cpu, node); + cpumask_clear_cpu(cpu, node_mask); } return 0; } @@ -736,34 +736,34 @@ static int cfs_cpt_choose_ncpus(struct cfs_cpt_table *cptab, int cpt, * As we cannot initialize a cpumask_var_t, we need * to alloc both before we can risk trying to free either */ - if (!zalloc_cpumask_var(&socket, GFP_NOFS)) + if (!zalloc_cpumask_var(&socket_mask, GFP_NOFS)) rc = -ENOMEM; - if (!zalloc_cpumask_var(&core, GFP_NOFS)) + if (!zalloc_cpumask_var(&core_mask, GFP_NOFS)) rc = -ENOMEM; if (rc) goto out; - while (!cpumask_empty(node)) { - cpu = cpumask_first(node); + while (!cpumask_empty(node_mask)) { + cpu = cpumask_first(node_mask); /* get cpumask for cores in the same socket */ - cpumask_copy(socket, topology_core_cpumask(cpu)); - cpumask_and(socket, socket, node); + cpumask_copy(socket_mask, topology_core_cpumask(cpu)); + cpumask_and(socket_mask, socket_mask, node_mask); - LASSERT(!cpumask_empty(socket)); + LASSERT(!cpumask_empty(socket_mask)); - while (!cpumask_empty(socket)) { + while (!cpumask_empty(socket_mask)) { int i; /* get cpumask for hts in the same core */ - cpumask_copy(core, topology_sibling_cpumask(cpu)); - cpumask_and(core, core, node); + cpumask_copy(core_mask, topology_sibling_cpumask(cpu)); + cpumask_and(core_mask, core_mask, node_mask); - LASSERT(!cpumask_empty(core)); + LASSERT(!cpumask_empty(core_mask)); - for_each_cpu(i, core) { - cpumask_clear_cpu(i, socket); - cpumask_clear_cpu(i, node); + for_each_cpu(i, core_mask) { + cpumask_clear_cpu(i, socket_mask); + cpumask_clear_cpu(i, node_mask); rc = cfs_cpt_set_cpu(cptab, cpt, i); if (!rc) { @@ -774,13 +774,13 @@ static int cfs_cpt_choose_ncpus(struct cfs_cpt_table *cptab, int cpt, if (!--number) goto out; } - cpu = cpumask_first(socket); + cpu = cpumask_first(socket_mask); } } out: - free_cpumask_var(socket); - free_cpumask_var(core); + free_cpumask_var(socket_mask); + free_cpumask_var(core_mask); return rc; } @@ -831,7 +831,7 @@ static int cfs_cpt_num_estimate(void) static struct cfs_cpt_table *cfs_cpt_table_create(int ncpt) { struct cfs_cpt_table *cptab = NULL; - cpumask_var_t mask; + cpumask_var_t node_mask; int cpt = 0; int num; int rc; @@ -864,15 +864,15 @@ static struct cfs_cpt_table *cfs_cpt_table_create(int ncpt) goto failed; } - if (!zalloc_cpumask_var(&mask, GFP_NOFS)) { + if (!zalloc_cpumask_var(&node_mask, GFP_NOFS)) { CERROR("Failed to allocate scratch cpumask\n"); goto failed; } for_each_online_node(i) { - cpumask_copy(mask, cpumask_of_node(i)); + cpumask_copy(node_mask, cpumask_of_node(i)); - while (!cpumask_empty(mask)) { + while (!cpumask_empty(node_mask)) { struct cfs_cpu_partition *part; int n; @@ -889,7 +889,7 @@ static struct cfs_cpt_table *cfs_cpt_table_create(int ncpt) n = num - cpumask_weight(part->cpt_cpumask); LASSERT(n > 0); - rc = cfs_cpt_choose_ncpus(cptab, cpt, mask, n); + rc = cfs_cpt_choose_ncpus(cptab, cpt, node_mask, n); if (rc < 0) goto failed_mask; @@ -907,12 +907,12 @@ static struct cfs_cpt_table *cfs_cpt_table_create(int ncpt) goto failed_mask; } - free_cpumask_var(mask); + free_cpumask_var(node_mask); return cptab; failed_mask: - free_cpumask_var(mask); + free_cpumask_var(node_mask); failed: CERROR("Failed to setup CPU-partition-table with %d CPU-partitions, online HW nodes: %d, HW cpus: %d.\n", ncpt, num_online_nodes(), num_online_cpus()); -- 1.8.3.1