Whamcloud - gitweb
Revert "LU-5050 libcfs: default CPT matches NUMA topology"
[fs/lustre-release.git] / libcfs / libcfs / linux / linux-cpu.c
index cfc53f1..d3d40ce 100644 (file)
@@ -23,7 +23,7 @@
 /*
  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
  *
- * Copyright (c) 2012, 2014, Intel Corporation.
+ * Copyright (c) 2012, 2015, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -48,7 +48,8 @@
  * >1 : specify number of partitions
  */
 static int     cpu_npartitions;
-CFS_MODULE_PARM(cpu_npartitions, "i", int, 0444, "# of CPU partitions");
+module_param(cpu_npartitions, int, 0444);
+MODULE_PARM_DESC(cpu_npartitions, "# of CPU partitions");
 
 /**
  * modparam for setting CPU partitions patterns:
@@ -64,7 +65,8 @@ CFS_MODULE_PARM(cpu_npartitions, "i", int, 0444, "# of CPU partitions");
  * NB: If user specified cpu_pattern, cpu_npartitions will be ignored
  */
 static char    *cpu_pattern = "";
-CFS_MODULE_PARM(cpu_pattern, "s", charp, 0444, "CPU partitions pattern");
+module_param(cpu_pattern, charp, 0444);
+MODULE_PARM_DESC(cpu_pattern, "CPU partitions pattern");
 
 struct cfs_cpt_data {
        /* serialize hotplug etc */
@@ -79,14 +81,6 @@ struct cfs_cpt_data {
 
 static struct cfs_cpt_data     cpt_data;
 
-void
-cfs_cpu_core_siblings(int cpu, cpumask_t *mask)
-{
-       /* return cpumask of cores in the same socket */
-       cpumask_copy(mask, topology_core_cpumask(cpu));
-}
-EXPORT_SYMBOL(cfs_cpu_core_siblings);
-
 /* return number of cores in the same socket of \a cpu */
 int
 cfs_cpu_core_nsiblings(int cpu)
@@ -95,22 +89,20 @@ cfs_cpu_core_nsiblings(int cpu)
 
        mutex_lock(&cpt_data.cpt_mutex);
 
-       cfs_cpu_core_siblings(cpu, cpt_data.cpt_cpumask);
+       cpumask_copy(cpt_data.cpt_cpumask, topology_core_cpumask(cpu));
        num = cpumask_weight(cpt_data.cpt_cpumask);
 
        mutex_unlock(&cpt_data.cpt_mutex);
 
        return num;
 }
-EXPORT_SYMBOL(cfs_cpu_core_nsiblings);
 
 /* return cpumask of HTs in the same core */
 void
 cfs_cpu_ht_siblings(int cpu, cpumask_t *mask)
 {
-       cpumask_copy(mask, topology_thread_cpumask(cpu));
+       cpumask_copy(mask, topology_sibling_cpumask(cpu));
 }
-EXPORT_SYMBOL(cfs_cpu_ht_siblings);
 
 /* return number of HTs in the same core of \a cpu */
 int
@@ -118,7 +110,7 @@ cfs_cpu_ht_nsiblings(int cpu)
 {
        int     num;
 
-       num = cpumask_weight(topology_thread_cpumask(cpu));
+       num = cpumask_weight(topology_sibling_cpumask(cpu));
 
        return num;
 }
@@ -134,7 +126,6 @@ cfs_node_to_cpumask(int node, cpumask_t *mask)
        else
                cpumask_clear(mask);
 }
-EXPORT_SYMBOL(cfs_node_to_cpumask);
 
 void
 cfs_cpt_table_free(struct cfs_cpt_table *cptab)
@@ -685,7 +676,7 @@ cfs_cpt_choose_ncpus(struct cfs_cpt_table *cptab, int cpt,
                cpu = cpumask_first(node);
 
                /* get cpumask for cores in the same socket */
-               cfs_cpu_core_siblings(cpu, socket);
+               cpumask_copy(socket, topology_core_cpumask(cpu));
                cpumask_and(socket, socket, node);
 
                LASSERT(!cpumask_empty(socket));
@@ -694,7 +685,7 @@ cfs_cpt_choose_ncpus(struct cfs_cpt_table *cptab, int cpt,
                        int     i;
 
                        /* get cpumask for hts in the same core */
-                       cfs_cpu_ht_siblings(cpu, core);
+                       cpumask_copy(core, topology_sibling_cpumask(cpu));
                        cpumask_and(core, core, node);
 
                        LASSERT(!cpumask_empty(core));
@@ -1042,7 +1033,8 @@ cfs_cpu_notify(struct notifier_block *self, unsigned long action, void *hcpu)
 
                mutex_lock(&cpt_data.cpt_mutex);
                /* if all HTs in a core are offline, it may break affinity */
-               cfs_cpu_ht_siblings(cpu, cpt_data.cpt_cpumask);
+               cpumask_copy(cpt_data.cpt_cpumask,
+                            topology_sibling_cpumask(cpu));
                warn = cpumask_any_and(cpt_data.cpt_cpumask,
                                       cpu_online_mask) >= nr_cpu_ids;
                mutex_unlock(&cpt_data.cpt_mutex);