Whamcloud - gitweb
LU-5050 libcfs: default CPT matches NUMA topology
[fs/lustre-release.git] / libcfs / libcfs / linux / linux-cpu.c
index d3d40ce..dca5d37 100644 (file)
@@ -64,7 +64,7 @@ MODULE_PARM_DESC(cpu_npartitions, "# of CPU partitions");
  *
  * NB: If user specified cpu_pattern, cpu_npartitions will be ignored
  */
-static char    *cpu_pattern = "";
+static char    *cpu_pattern = "N";
 module_param(cpu_pattern, charp, 0444);
 MODULE_PARM_DESC(cpu_pattern, "CPU partitions pattern");
 
@@ -1088,7 +1088,15 @@ cfs_cpu_init(void)
 #endif
 
        if (*cpu_pattern != 0) {
-               cfs_cpt_table = cfs_cpt_table_create_pattern(cpu_pattern);
+               char *cpu_pattern_dup = kstrdup(cpu_pattern, GFP_KERNEL);
+
+               if (cpu_pattern_dup == NULL) {
+                       CERROR("Failed to duplicate cpu_pattern\n");
+                       goto failed;
+               }
+
+               cfs_cpt_table = cfs_cpt_table_create_pattern(cpu_pattern_dup);
+               kfree(cpu_pattern_dup);
                if (cfs_cpt_table == NULL) {
                        CERROR("Failed to create cptab from pattern %s\n",
                               cpu_pattern);