Received: by 10.192.165.156 with SMTP id m28csp226545imm; Sun, 15 Apr 2018 21:44:51 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/AYQ/3ai+rIVhdA/uV+i5UX9EdWQFOi5IfgSJpTirbfvh/MBXVaMvd8tR/aXVVgQ9cMswR X-Received: by 10.99.154.9 with SMTP id o9mr11595160pge.318.1523853890976; Sun, 15 Apr 2018 21:44:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523853890; cv=none; d=google.com; s=arc-20160816; b=O5IxONqeAc0UFnk0LSMS+kwHPwvIRi0BRrVbZZ1absuuQaHEHey9llNI5qRceWDpm4 sDVKWO8bSJAdysd2EP8cCuVKpcRNBlZcMDg8mUU1CEKzqMkMlzwUMug6h7E8zF/wA4lv 9LzypRMT9fkwUVsrz/RCeoxHdvWTboXwzAA0RcmtYk1DTUmGHajhOCBxsS5wEQ/sK5UN M768t8L8nda1zCewTaEc6AY2YGYQi2Bs2UjeP3JACHepnYmkQ7cigLKEytR1gy9SlEVt n4j6HQ29F/6jJFmQ20GxUlQgmcTqvXzMdbfRNCLyIdsCA9qWd1RZn8LV9odcDx1g4fFs hD6w== 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=P4A6odAG4pkPtBIGuEqyc8UpsRs/706jnNZTl+soqcY=; b=RfpShnP/t77/Pdgw4WeXDeLkDdFvw5VBLBbdRZ8GfsQA2Vf4frvAhpiAAf4g9S1yrD pFgAxaOpF6mLhxnV9j0Ld7CII0prN37O0jBMLo3v/WZMaW0JciP6rWwZSfOd6lIlB3JO Jd9ReHuKpMc4m49T+TCyV4zZ6+0uqhVnG11zrPlNVt/D1blGkPG6TJpvpBfFH1oesC/2 gkF2ie+r5w6jp20iIYqVEX2o2clFJIRPb+FQGIbZxbxOATlhp3nUa3QfIZvUzVcf1ktb cxpo1EPrtkMhkWNHEjmrmVAsJ+WbJtw5psydtNOre6U1fbMaXDhEB6ynsY46oSvWbgPE s1XQ== 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 f7si8610948pgs.556.2018.04.15.21.44.37; Sun, 15 Apr 2018 21:44:50 -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 S1752876AbeDPEKW (ORCPT + 99 others); Mon, 16 Apr 2018 00:10:22 -0400 Received: from smtp3.ccs.ornl.gov ([160.91.203.39]:36400 "EHLO smtp3.ccs.ornl.gov" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751893AbeDPEKR (ORCPT ); Mon, 16 Apr 2018 00:10:17 -0400 Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id 95D74343; Mon, 16 Apr 2018 00:10:11 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 91A811F3; Mon, 16 Apr 2018 00:10:11 -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 , Amir Shehata , James Simmons Subject: [PATCH 07/25] staging: lustre: libcfs: NUMA support Date: Mon, 16 Apr 2018 00:09:49 -0400 Message-Id: <1523851807-16573-8-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1523851807-16573-1-git-send-email-jsimmons@infradead.org> References: <1523851807-16573-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: Amir Shehata This patch adds NUMA node support. NUMA node information is stored in the CPT table. A NUMA node mask is maintained for the entire table as well as for each CPT to track the NUMA nodes related to each of the CPTs. Add new function cfs_cpt_of_node() which returns the CPT of a particular NUMA node. Signed-off-by: Amir Shehata Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7734 Reviewed-on: http://review.whamcloud.com/18916 Reviewed-by: Olaf Weber Reviewed-by: Doug Oucharek Signed-off-by: James Simmons --- .../staging/lustre/include/linux/libcfs/libcfs_cpu.h | 4 ++++ .../lustre/include/linux/libcfs/linux/linux-cpu.h | 2 ++ drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c | 6 ++++++ drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c | 19 +++++++++++++++++++ 4 files changed, 31 insertions(+) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h index 070f8fe..839ec02 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h @@ -139,6 +139,10 @@ struct cfs_cpt_table { */ int cfs_cpt_of_cpu(struct cfs_cpt_table *cptab, int cpu); /** + * shadow HW node ID \a NODE to CPU-partition ID by \a cptab + */ +int cfs_cpt_of_node(struct cfs_cpt_table *cptab, int node); +/** * bind current thread on a CPU-partition \a cpt of \a cptab */ int cfs_cpt_bind(struct cfs_cpt_table *cptab, int cpt); diff --git a/drivers/staging/lustre/include/linux/libcfs/linux/linux-cpu.h b/drivers/staging/lustre/include/linux/libcfs/linux/linux-cpu.h index e8bbbaa..1bed0ba 100644 --- a/drivers/staging/lustre/include/linux/libcfs/linux/linux-cpu.h +++ b/drivers/staging/lustre/include/linux/libcfs/linux/linux-cpu.h @@ -68,6 +68,8 @@ struct cfs_cpt_table { int *ctb_cpu2cpt; /* all cpus in this partition table */ cpumask_var_t ctb_cpumask; + /* shadow HW node to CPU partition ID */ + int *ctb_node2cpt; /* all nodes in this partition table */ nodemask_t *ctb_nodemask; }; diff --git a/drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c b/drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c index 5ea294f..e6d1512 100644 --- a/drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c +++ b/drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c @@ -198,6 +198,12 @@ cpumask_var_t *cfs_cpt_cpumask(struct cfs_cpt_table *cptab, int cpt) } EXPORT_SYMBOL(cfs_cpt_of_cpu); +int cfs_cpt_of_node(struct cfs_cpt_table *cptab, int node) +{ + return 0; +} +EXPORT_SYMBOL(cfs_cpt_of_node); + int cfs_cpt_bind(struct cfs_cpt_table *cptab, int cpt) { diff --git a/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c b/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c index 741db69..fd0c451 100644 --- a/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c +++ b/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c @@ -70,6 +70,7 @@ int i; kvfree(cptab->ctb_cpu2cpt); + kvfree(cptab->ctb_node2cpt); for (i = 0; cptab->ctb_parts && i < cptab->ctb_nparts; i++) { struct cfs_cpu_partition *part = &cptab->ctb_parts[i]; @@ -114,6 +115,15 @@ struct cfs_cpt_table * memset(cptab->ctb_cpu2cpt, -1, nr_cpu_ids * sizeof(cptab->ctb_cpu2cpt[0])); + cptab->ctb_node2cpt = kvmalloc_array(nr_node_ids, + sizeof(cptab->ctb_node2cpt[0]), + GFP_KERNEL); + if (!cptab->ctb_node2cpt) + goto failed; + + memset(cptab->ctb_node2cpt, -1, + nr_node_ids * sizeof(cptab->ctb_node2cpt[0])); + cptab->ctb_parts = kvmalloc_array(ncpt, sizeof(cptab->ctb_parts[0]), GFP_KERNEL); if (!cptab->ctb_parts) @@ -484,6 +494,15 @@ struct cfs_cpt_table * } EXPORT_SYMBOL(cfs_cpt_of_cpu); +int cfs_cpt_of_node(struct cfs_cpt_table *cptab, int node) +{ + if (node < 0 || node > nr_node_ids) + return CFS_CPT_ANY; + + return cptab->ctb_node2cpt[node]; +} +EXPORT_SYMBOL(cfs_cpt_of_node); + int cfs_cpt_bind(struct cfs_cpt_table *cptab, int cpt) { -- 1.8.3.1