Whamcloud - gitweb
LU-17501 libcfs: fix CPT NUMA core exclusion handling 47/56347/4
authorFrederick Dilger <fdilger@whamcloud.com>
Thu, 12 Sep 2024 22:46:38 +0000 (16:46 -0600)
committerOleg Drokin <green@whamcloud.com>
Mon, 9 Dec 2024 06:10:05 +0000 (06:10 +0000)
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 <fdilger@whamcloud.com>
Change-Id: I22e1fe1aa73e413cf9c32562ec96f0cf4bd16fe5
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/56347
Tested-by: Maloo <maloo@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Andrew Perepechko <andrew.perepechko@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/lnet/lib-cpt.c

index 5e845cf..accd3f9 100644 (file)
@@ -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;