From 660787c66fa80182a55c0f89895880a884fe0ba5 Mon Sep 17 00:00:00 2001 From: Frederick Dilger Date: Thu, 12 Sep 2024 16:46:38 -0600 Subject: [PATCH] LU-17501 libcfs: fix CPT NUMA core exclusion handling The cfs_cpt_unset_node_core() function was only setting the offset a single time for the first node, and using the same offset for all other nodes. cpu_pattern='C[0]' was only removing the first core on the first NUMA node when it should be removing a core on every NUMA node. It produced an output like: cpu_partition_table= 0 : 1 1 : 2 3 2 : 4 5 when it should have been: cpu_partition_table= 0 : 1 1 : 3 2 : 5 Signed-off-by: Frederick Dilger Change-Id: I22e1fe1aa73e413cf9c32562ec96f0cf4bd16fe5 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/56347 Tested-by: Maloo Tested-by: jenkins Reviewed-by: Andreas Dilger Reviewed-by: Andrew Perepechko Reviewed-by: Oleg Drokin --- lnet/lnet/lib-cpt.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lnet/lnet/lib-cpt.c b/lnet/lnet/lib-cpt.c index 5e845cf..accd3f9 100644 --- a/lnet/lnet/lib-cpt.c +++ b/lnet/lnet/lib-cpt.c @@ -628,9 +628,10 @@ int cfs_cpt_set_node_core(struct cfs_cpt_table *cptab, int cpt, { const cpumask_t *mask; int node, cpu; - int offset = -1; + int offset; for_each_online_node(node) { + offset = -1; mask = cpumask_of_node(node); if (cpumask_empty(mask)) continue; @@ -653,9 +654,10 @@ void cfs_cpt_unset_node_core(struct cfs_cpt_table *cptab, int cpt, { const cpumask_t *mask; int node, cpu; - int offset = -1; + int offset; for_each_online_node(node) { + offset = -1; mask = cpumask_of_node(node); if (cpumask_empty(mask)) continue; @@ -995,7 +997,7 @@ static struct cfs_cpt_table *cfs_cpt_table_create_pattern(const char *pattern) char *str; bool exclude = false; int node = 0; - int ncpt = 0; + int ncpt = cpu_npartitions; int cpt = 0; int high = 0; int rc; -- 1.8.3.1