Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3450829imm; Tue, 29 May 2018 07:29:21 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpOLD4ZaCKmjMB0F3PYdDXcDV3UUt0muHvneSSI+dx6p3CrXxB+PBGQRslSDJG2qRgXiTTC X-Received: by 2002:a17:902:a512:: with SMTP id s18-v6mr17769779plq.223.1527604160979; Tue, 29 May 2018 07:29:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527604160; cv=none; d=google.com; s=arc-20160816; b=LB3MAxoHd4fn/VqUFTkgNv2qHCfKvZO5khX4L3fzPRVs/Hy+feuvqEZ6EpNaoIRekm NqlA+u7D7rJK3SqGN8r6kONe0UFgUEJFn5YuDBh9bEtv4jQmPqt1Tj9sKmIrF40kwDyg Lt7AXVA1yiA6cxI7VTd13OGhARViy35O+Vopj1k0mmm636lQT1GSS4e/SwG7OSfdicu1 fRuDoj0LiqEyY+eEPCWfwB5j5YzL5MbODL9JEX8XuFTskFyNF7q7oH2oVVIXbgMbN/4O 7SEv7ZmVJueIU5lRVN7zAJ5ghTb9qgMZfzcn/TKarl+BJzkDHsVX4qc0enoRdo+o7HA6 ILMQ== 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=jr8zpYOOU50BxKb7sAbYe61BlSDkWK/fOTOq5Qxuxas=; b=geWCCQYYv8V8T1XaKXXuiIE63hIvXLKsB9WSbYKtuqLWew+IheDVjUpeo+FKix1bfs KFWnELxqLLbTHe9/U/c5fIiPZB+8RDx6J4PA/gHofvvv82hIv5CCqF6lKhghUui3PADV 4OJI4lJBkO+pWa4W4BYTIqRi3NcwQdxpCjfE7wj2S6ZD2/cEySNhRHsqcPxQE7w1RkNI EC/Z2RzSxK2xa0RB52Zq6SFTu4lfCPxIWuWZwXBgbRIslwSjySNv3jR6X2f3MNaIvtdG tARsuGa4WhCCO2Ff1dMOS9mT3D5UREQhRSIlOvTsIaicKIilKOJTy8e3GSaH6PpCI+EC 0WbA== 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 b67-v6si32350189pfa.71.2018.05.29.07.29.07; Tue, 29 May 2018 07:29:20 -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 S935324AbeE2O1z (ORCPT + 99 others); Tue, 29 May 2018 10:27:55 -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 S935137AbeE2OWT (ORCPT ); Tue, 29 May 2018 10:22:19 -0400 Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp4.ccs.ornl.gov (Postfix) with ESMTP id D5DDE10052C3; Tue, 29 May 2018 10:22:06 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id D3D1A2C1; 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 , Amir Shehata , James Simmons Subject: [PATCH v2 08/25] staging: lustre: libcfs: NUMA support Date: Tue, 29 May 2018 10:21:48 -0400 Message-Id: <1527603725-30560-9-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: 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 --- Changelog: v1) Initial patch v2) Rebased patch to handle recent libcfs changes .../lustre/include/linux/libcfs/libcfs_cpu.h | 11 +++++++++++ drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c | 21 +++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h index 3626969..487625d 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h @@ -103,6 +103,8 @@ struct cfs_cpt_table { struct cfs_cpu_partition *ctb_parts; /* shadow HW CPU to CPU partition ID */ int *ctb_cpu2cpt; + /* shadow HW node to CPU partition ID */ + int *ctb_node2cpt; /* all nodes in this partition table */ nodemask_t *ctb_nodemask; #else @@ -157,6 +159,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); @@ -345,6 +351,11 @@ static inline int cfs_cpt_table_print(struct cfs_cpt_table *cptab, return 0; } +static inline int cfs_cpt_of_node(struct cfs_cpt_table *cptab, int node) +{ + return 0; +} + static inline int cfs_cpt_bind(struct cfs_cpt_table *cptab, int cpt) { diff --git a/drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c b/drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c index 3f855a8..f616073 100644 --- a/drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c +++ b/drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c @@ -98,6 +98,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_alloc_node2cpt; + + 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) @@ -129,6 +138,8 @@ struct cfs_cpt_table * kvfree(cptab->ctb_parts); failed_alloc_ctb_parts: + kvfree(cptab->ctb_node2cpt); +failed_alloc_node2cpt: kvfree(cptab->ctb_cpu2cpt); failed_alloc_cpu2cpt: kfree(cptab->ctb_nodemask); @@ -146,6 +157,7 @@ struct cfs_cpt_table * 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]; @@ -511,6 +523,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