This patch bring the lustre CPT code into alignment with the Linux kernel.
* use int type for CPT identification like CPU identification.
* fix coding style.
Change-Id: I5df33f37757eb6d47ab4e824ec1b800a40730f61
Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-on: https://review.whamcloud.com/23304
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Doug Oucharek <doug.s.oucharek@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
/**
* create a cfs_cpt_table with \a ncpt number of partitions
*/
/**
* create a cfs_cpt_table with \a ncpt number of partitions
*/
-struct cfs_cpt_table *cfs_cpt_table_alloc(unsigned int ncpt);
+struct cfs_cpt_table *cfs_cpt_table_alloc(int ncpt);
/**
* print string information of cpt-table
*/
/**
* print string information of cpt-table
*/
/**
* return total number of CPU partitions in \a cptab
*/
/**
* return total number of CPU partitions in \a cptab
*/
-int
-cfs_cpt_number(struct cfs_cpt_table *cptab);
+int cfs_cpt_number(struct cfs_cpt_table *cptab);
/**
* return number of HW cores or hypter-threadings in a CPU partition \a cpt
*/
/**
* return number of HW cores or hypter-threadings in a CPU partition \a cpt
*/
* add all cpus in \a mask to CPU partition \a cpt
* return 1 if successfully set all CPUs, otherwise return 0
*/
* add all cpus in \a mask to CPU partition \a cpt
* return 1 if successfully set all CPUs, otherwise return 0
*/
-int cfs_cpt_set_cpumask(struct cfs_cpt_table *cptab,
- int cpt, const cpumask_t *mask);
+
+int cfs_cpt_set_cpumask(struct cfs_cpt_table *cptab, int cpt,
+ const cpumask_t *mask);
/**
* remove all cpus in \a mask from CPU partition \a cpt
*/
/**
* remove all cpus in \a mask from CPU partition \a cpt
*/
-void cfs_cpt_unset_cpumask(struct cfs_cpt_table *cptab,
- int cpt, const cpumask_t *mask);
+void cfs_cpt_unset_cpumask(struct cfs_cpt_table *cptab, int cpt,
+ const cpumask_t *mask);
/**
* add all cpus in NUMA node \a node to CPU partition \a cpt
* return 1 if successfully set all CPUs, otherwise return 0
/**
* add all cpus in NUMA node \a node to CPU partition \a cpt
* return 1 if successfully set all CPUs, otherwise return 0
* add all cpus in node mask \a mask to CPU partition \a cpt
* return 1 if successfully set all CPUs, otherwise return 0
*/
* add all cpus in node mask \a mask to CPU partition \a cpt
* return 1 if successfully set all CPUs, otherwise return 0
*/
-int cfs_cpt_set_nodemask(struct cfs_cpt_table *cptab,
- int cpt, nodemask_t *mask);
+int cfs_cpt_set_nodemask(struct cfs_cpt_table *cptab, int cpt,
+ const nodemask_t *mask);
/**
* remove all cpus in node mask \a mask from CPU partition \a cpt
*/
/**
* remove all cpus in node mask \a mask from CPU partition \a cpt
*/
-void cfs_cpt_unset_nodemask(struct cfs_cpt_table *cptab,
- int cpt, nodemask_t *mask);
+void cfs_cpt_unset_nodemask(struct cfs_cpt_table *cptab, int cpt,
+ const nodemask_t *mask);
/**
* convert partition id \a cpt to numa node id, if there are more than one
* nodes in this partition, it might return a different node id each time.
/**
* convert partition id \a cpt to numa node id, if there are more than one
* nodes in this partition, it might return a different node id each time.
/* NUMA distance between CPTs */
unsigned *cpt_distance;
/* spread rotor for NUMA allocator */
/* NUMA distance between CPTs */
unsigned *cpt_distance;
/* spread rotor for NUMA allocator */
- unsigned cpt_spread_rotor;
};
/** descriptor for CPU partitions */
struct cfs_cpt_table {
/* spread rotor for NUMA allocator */
};
/** descriptor for CPU partitions */
struct cfs_cpt_table {
/* spread rotor for NUMA allocator */
- unsigned ctb_spread_rotor;
/* maximum NUMA distance between all nodes in table */
unsigned ctb_distance;
/* # of CPU partitions */
/* maximum NUMA distance between all nodes in table */
unsigned ctb_distance;
/* # of CPU partitions */
/* partitions tables */
struct cfs_cpu_partition *ctb_parts;
/* shadow HW CPU to CPU partition ID */
/* partitions tables */
struct cfs_cpu_partition *ctb_parts;
/* shadow HW CPU to CPU partition ID */
#include <libcfs/libcfs.h>
/** Global CPU partition table */
#include <libcfs/libcfs.h>
/** Global CPU partition table */
-struct cfs_cpt_table *cfs_cpt_table __read_mostly = NULL;
+struct cfs_cpt_table *cfs_cpt_table __read_mostly = NULL;
EXPORT_SYMBOL(cfs_cpt_table);
#ifndef HAVE_LIBCFS_CPT
EXPORT_SYMBOL(cfs_cpt_table);
#ifndef HAVE_LIBCFS_CPT
#define CFS_CPT_DISTANCE 1 /* Arbitrary positive value */
#define CFS_CPT_DISTANCE 1 /* Arbitrary positive value */
-struct cfs_cpt_table *
-cfs_cpt_table_alloc(unsigned int ncpt)
+struct cfs_cpt_table *cfs_cpt_table_alloc(int ncpt)
{
struct cfs_cpt_table *cptab;
{
struct cfs_cpt_table *cptab;
}
EXPORT_SYMBOL(cfs_cpt_table_alloc);
}
EXPORT_SYMBOL(cfs_cpt_table_alloc);
-void
-cfs_cpt_table_free(struct cfs_cpt_table *cptab)
+void cfs_cpt_table_free(struct cfs_cpt_table *cptab)
{
LASSERT(cptab->ctb_version == CFS_CPU_VERSION_MAGIC);
{
LASSERT(cptab->ctb_version == CFS_CPU_VERSION_MAGIC);
}
EXPORT_SYMBOL(cfs_cpt_table_free);
}
EXPORT_SYMBOL(cfs_cpt_table_free);
-int
-cfs_cpt_table_print(struct cfs_cpt_table *cptab, char *buf, int len)
+int cfs_cpt_table_print(struct cfs_cpt_table *cptab, char *buf, int len)
rc = snprintf(buf, len, "%d\t: %d\n", 0, 0);
len -= rc;
rc = snprintf(buf, len, "%d\t: %d\n", 0, 0);
len -= rc;
}
EXPORT_SYMBOL(cfs_cpt_table_print);
}
EXPORT_SYMBOL(cfs_cpt_table_print);
-int
-cfs_cpt_distance_print(struct cfs_cpt_table *cptab, char *buf, int len)
+int cfs_cpt_distance_print(struct cfs_cpt_table *cptab, char *buf, int len)
}
EXPORT_SYMBOL(cfs_cpt_distance_print);
}
EXPORT_SYMBOL(cfs_cpt_distance_print);
-int
-cfs_cpt_number(struct cfs_cpt_table *cptab)
+int cfs_cpt_number(struct cfs_cpt_table *cptab)
{
return 1;
}
EXPORT_SYMBOL(cfs_cpt_number);
{
return 1;
}
EXPORT_SYMBOL(cfs_cpt_number);
-int
-cfs_cpt_weight(struct cfs_cpt_table *cptab, int cpt)
+int cfs_cpt_weight(struct cfs_cpt_table *cptab, int cpt)
{
return 1;
}
EXPORT_SYMBOL(cfs_cpt_weight);
{
return 1;
}
EXPORT_SYMBOL(cfs_cpt_weight);
-int
-cfs_cpt_online(struct cfs_cpt_table *cptab, int cpt)
+int cfs_cpt_online(struct cfs_cpt_table *cptab, int cpt)
{
return 1;
}
EXPORT_SYMBOL(cfs_cpt_online);
{
return 1;
}
EXPORT_SYMBOL(cfs_cpt_online);
-cpumask_t *
-cfs_cpt_cpumask(struct cfs_cpt_table *cptab, int cpt)
+cpumask_t *cfs_cpt_cpumask(struct cfs_cpt_table *cptab, int cpt)
{
return &cptab->ctb_mask;
}
EXPORT_SYMBOL(cfs_cpt_cpumask);
{
return &cptab->ctb_mask;
}
EXPORT_SYMBOL(cfs_cpt_cpumask);
-nodemask_t *
-cfs_cpt_nodemask(struct cfs_cpt_table *cptab, int cpt)
+nodemask_t *cfs_cpt_nodemask(struct cfs_cpt_table *cptab, int cpt)
{
return &cptab->ctb_nodemask;
}
EXPORT_SYMBOL(cfs_cpt_nodemask);
{
return &cptab->ctb_nodemask;
}
EXPORT_SYMBOL(cfs_cpt_nodemask);
-unsigned
-cfs_cpt_distance(struct cfs_cpt_table *cptab, int cpt1, int cpt2)
+unsigned cfs_cpt_distance(struct cfs_cpt_table *cptab, int cpt1, int cpt2)
{
return CFS_CPT_DISTANCE;
}
EXPORT_SYMBOL(cfs_cpt_distance);
{
return CFS_CPT_DISTANCE;
}
EXPORT_SYMBOL(cfs_cpt_distance);
-int
-cfs_cpt_set_cpu(struct cfs_cpt_table *cptab, int cpt, int cpu)
+int cfs_cpt_set_cpu(struct cfs_cpt_table *cptab, int cpt, int cpu)
{
return 1;
}
EXPORT_SYMBOL(cfs_cpt_set_cpu);
{
return 1;
}
EXPORT_SYMBOL(cfs_cpt_set_cpu);
-void
-cfs_cpt_unset_cpu(struct cfs_cpt_table *cptab, int cpt, int cpu)
+void cfs_cpt_unset_cpu(struct cfs_cpt_table *cptab, int cpt, int cpu)
{
}
EXPORT_SYMBOL(cfs_cpt_unset_cpu);
{
}
EXPORT_SYMBOL(cfs_cpt_unset_cpu);
-int
-cfs_cpt_set_cpumask(struct cfs_cpt_table *cptab, int cpt, const cpumask_t *mask)
+int cfs_cpt_set_cpumask(struct cfs_cpt_table *cptab, int cpt,
+ const cpumask_t *mask)
{
return 1;
}
EXPORT_SYMBOL(cfs_cpt_set_cpumask);
{
return 1;
}
EXPORT_SYMBOL(cfs_cpt_set_cpumask);
-void
-cfs_cpt_unset_cpumask(struct cfs_cpt_table *cptab, int cpt,
- const cpumask_t *mask)
+void cfs_cpt_unset_cpumask(struct cfs_cpt_table *cptab, int cpt,
+ const cpumask_t *mask)
{
}
EXPORT_SYMBOL(cfs_cpt_unset_cpumask);
{
}
EXPORT_SYMBOL(cfs_cpt_unset_cpumask);
-int
-cfs_cpt_set_node(struct cfs_cpt_table *cptab, int cpt, int node)
+int cfs_cpt_set_node(struct cfs_cpt_table *cptab, int cpt, int node)
{
return 1;
}
EXPORT_SYMBOL(cfs_cpt_set_node);
{
return 1;
}
EXPORT_SYMBOL(cfs_cpt_set_node);
-void
-cfs_cpt_unset_node(struct cfs_cpt_table *cptab, int cpt, int node)
+void cfs_cpt_unset_node(struct cfs_cpt_table *cptab, int cpt, int node)
{
}
EXPORT_SYMBOL(cfs_cpt_unset_node);
{
}
EXPORT_SYMBOL(cfs_cpt_unset_node);
-int
-cfs_cpt_set_nodemask(struct cfs_cpt_table *cptab, int cpt, nodemask_t *mask)
+int cfs_cpt_set_nodemask(struct cfs_cpt_table *cptab, int cpt,
+ const nodemask_t *mask)
{
return 1;
}
EXPORT_SYMBOL(cfs_cpt_set_nodemask);
{
return 1;
}
EXPORT_SYMBOL(cfs_cpt_set_nodemask);
-void
-cfs_cpt_unset_nodemask(struct cfs_cpt_table *cptab, int cpt, nodemask_t *mask)
+void cfs_cpt_unset_nodemask(struct cfs_cpt_table *cptab, int cpt,
+ const nodemask_t *mask)
{
}
EXPORT_SYMBOL(cfs_cpt_unset_nodemask);
{
}
EXPORT_SYMBOL(cfs_cpt_unset_nodemask);
-int
-cfs_cpt_spread_node(struct cfs_cpt_table *cptab, int cpt)
+int cfs_cpt_spread_node(struct cfs_cpt_table *cptab, int cpt)
{
return 0;
}
EXPORT_SYMBOL(cfs_cpt_spread_node);
{
return 0;
}
EXPORT_SYMBOL(cfs_cpt_spread_node);
-int
-cfs_cpt_current(struct cfs_cpt_table *cptab, int remap)
+int cfs_cpt_current(struct cfs_cpt_table *cptab, int remap)
{
return 0;
}
EXPORT_SYMBOL(cfs_cpt_current);
{
return 0;
}
EXPORT_SYMBOL(cfs_cpt_current);
-int
-cfs_cpt_of_cpu(struct cfs_cpt_table *cptab, int cpu)
+int cfs_cpt_of_cpu(struct cfs_cpt_table *cptab, int cpu)
{
return 0;
}
EXPORT_SYMBOL(cfs_cpt_of_cpu);
{
return 0;
}
EXPORT_SYMBOL(cfs_cpt_of_cpu);
-int
-cfs_cpt_of_node(struct cfs_cpt_table *cptab, int node)
+int cfs_cpt_of_node(struct cfs_cpt_table *cptab, int node)
{
return 0;
}
EXPORT_SYMBOL(cfs_cpt_of_node);
{
return 0;
}
EXPORT_SYMBOL(cfs_cpt_of_node);
-int
-cfs_cpt_bind(struct cfs_cpt_table *cptab, int cpt)
+int cfs_cpt_bind(struct cfs_cpt_table *cptab, int cpt)
{
return 0;
}
EXPORT_SYMBOL(cfs_cpt_bind);
{
return 0;
}
EXPORT_SYMBOL(cfs_cpt_bind);
-void
-cfs_cpu_fini(void)
{
if (cfs_cpt_table != NULL) {
cfs_cpt_table_free(cfs_cpt_table);
{
if (cfs_cpt_table != NULL) {
cfs_cpt_table_free(cfs_cpt_table);
{
cfs_cpt_table = cfs_cpt_table_alloc(1);
{
cfs_cpt_table = cfs_cpt_table_alloc(1);
* 1 : disable multiple partitions
* >1 : specify number of partitions
*/
* 1 : disable multiple partitions
* >1 : specify number of partitions
*/
-static int cpu_npartitions;
+static int cpu_npartitions;
module_param(cpu_npartitions, int, 0444);
MODULE_PARM_DESC(cpu_npartitions, "# of CPU partitions");
module_param(cpu_npartitions, int, 0444);
MODULE_PARM_DESC(cpu_npartitions, "# of CPU partitions");
*
* NB: If user specified cpu_pattern, cpu_npartitions will be ignored
*/
*
* NB: If user specified cpu_pattern, cpu_npartitions will be ignored
*/
-static char *cpu_pattern = "N";
+static char *cpu_pattern = "N";
module_param(cpu_pattern, charp, 0444);
MODULE_PARM_DESC(cpu_pattern, "CPU partitions pattern");
module_param(cpu_pattern, charp, 0444);
MODULE_PARM_DESC(cpu_pattern, "CPU partitions pattern");
-void
-cfs_cpt_table_free(struct cfs_cpt_table *cptab)
+void cfs_cpt_table_free(struct cfs_cpt_table *cptab)
}
EXPORT_SYMBOL(cfs_cpt_table_free);
}
EXPORT_SYMBOL(cfs_cpt_table_free);
-struct cfs_cpt_table *
-cfs_cpt_table_alloc(unsigned int ncpt)
+struct cfs_cpt_table *cfs_cpt_table_alloc(int ncpt)
{
struct cfs_cpt_table *cptab;
{
struct cfs_cpt_table *cptab;
LIBCFS_ALLOC(cptab, sizeof(*cptab));
if (cptab == NULL)
LIBCFS_ALLOC(cptab, sizeof(*cptab));
if (cptab == NULL)
}
EXPORT_SYMBOL(cfs_cpt_table_alloc);
}
EXPORT_SYMBOL(cfs_cpt_table_alloc);
-int
-cfs_cpt_table_print(struct cfs_cpt_table *cptab, char *buf, int len)
+int cfs_cpt_table_print(struct cfs_cpt_table *cptab, char *buf, int len)
{
char *tmp = buf;
int rc = -EFBIG;
{
char *tmp = buf;
int rc = -EFBIG;
}
EXPORT_SYMBOL(cfs_cpt_table_print);
}
EXPORT_SYMBOL(cfs_cpt_table_print);
-int
-cfs_cpt_distance_print(struct cfs_cpt_table *cptab, char *buf, int len)
+int cfs_cpt_distance_print(struct cfs_cpt_table *cptab, char *buf, int len)
{
char *tmp = buf;
int rc = -EFBIG;
{
char *tmp = buf;
int rc = -EFBIG;
}
EXPORT_SYMBOL(cfs_cpt_distance_print);
}
EXPORT_SYMBOL(cfs_cpt_distance_print);
-int
-cfs_cpt_number(struct cfs_cpt_table *cptab)
+int cfs_cpt_number(struct cfs_cpt_table *cptab)
{
return cptab->ctb_nparts;
}
EXPORT_SYMBOL(cfs_cpt_number);
{
return cptab->ctb_nparts;
}
EXPORT_SYMBOL(cfs_cpt_number);
-int
-cfs_cpt_weight(struct cfs_cpt_table *cptab, int cpt)
+int cfs_cpt_weight(struct cfs_cpt_table *cptab, int cpt)
{
LASSERT(cpt == CFS_CPT_ANY || (cpt >= 0 && cpt < cptab->ctb_nparts));
{
LASSERT(cpt == CFS_CPT_ANY || (cpt >= 0 && cpt < cptab->ctb_nparts));
}
EXPORT_SYMBOL(cfs_cpt_weight);
}
EXPORT_SYMBOL(cfs_cpt_weight);
-int
-cfs_cpt_online(struct cfs_cpt_table *cptab, int cpt)
+int cfs_cpt_online(struct cfs_cpt_table *cptab, int cpt)
{
LASSERT(cpt == CFS_CPT_ANY || (cpt >= 0 && cpt < cptab->ctb_nparts));
{
LASSERT(cpt == CFS_CPT_ANY || (cpt >= 0 && cpt < cptab->ctb_nparts));
}
EXPORT_SYMBOL(cfs_cpt_online);
}
EXPORT_SYMBOL(cfs_cpt_online);
-cpumask_t *
-cfs_cpt_cpumask(struct cfs_cpt_table *cptab, int cpt)
+cpumask_t *cfs_cpt_cpumask(struct cfs_cpt_table *cptab, int cpt)
{
LASSERT(cpt == CFS_CPT_ANY || (cpt >= 0 && cpt < cptab->ctb_nparts));
{
LASSERT(cpt == CFS_CPT_ANY || (cpt >= 0 && cpt < cptab->ctb_nparts));
}
EXPORT_SYMBOL(cfs_cpt_cpumask);
}
EXPORT_SYMBOL(cfs_cpt_cpumask);
-nodemask_t *
-cfs_cpt_nodemask(struct cfs_cpt_table *cptab, int cpt)
+nodemask_t *cfs_cpt_nodemask(struct cfs_cpt_table *cptab, int cpt)
{
LASSERT(cpt == CFS_CPT_ANY || (cpt >= 0 && cpt < cptab->ctb_nparts));
{
LASSERT(cpt == CFS_CPT_ANY || (cpt >= 0 && cpt < cptab->ctb_nparts));
}
EXPORT_SYMBOL(cfs_cpt_nodemask);
}
EXPORT_SYMBOL(cfs_cpt_nodemask);
-unsigned
-cfs_cpt_distance(struct cfs_cpt_table *cptab, int cpt1, int cpt2)
+unsigned cfs_cpt_distance(struct cfs_cpt_table *cptab, int cpt1, int cpt2)
{
LASSERT(cpt1 == CFS_CPT_ANY || (cpt1 >= 0 && cpt1 < cptab->ctb_nparts));
LASSERT(cpt2 == CFS_CPT_ANY || (cpt2 >= 0 && cpt2 < cptab->ctb_nparts));
{
LASSERT(cpt1 == CFS_CPT_ANY || (cpt1 >= 0 && cpt1 < cptab->ctb_nparts));
LASSERT(cpt2 == CFS_CPT_ANY || (cpt2 >= 0 && cpt2 < cptab->ctb_nparts));
* Calculate the maximum NUMA distance between all nodes in the
* from_mask and all nodes in the to_mask.
*/
* Calculate the maximum NUMA distance between all nodes in the
* from_mask and all nodes in the to_mask.
*/
-static unsigned
-cfs_cpt_distance_calculate(nodemask_t *from_mask, nodemask_t *to_mask)
+static unsigned cfs_cpt_distance_calculate(nodemask_t *from_mask,
+ nodemask_t *to_mask)
{
unsigned maximum;
unsigned distance;
{
unsigned maximum;
unsigned distance;
-int
-cfs_cpt_set_cpu(struct cfs_cpt_table *cptab, int cpt, int cpu)
+int cfs_cpt_set_cpu(struct cfs_cpt_table *cptab, int cpt, int cpu)
{
LASSERT(cpt >= 0 && cpt < cptab->ctb_nparts);
{
LASSERT(cpt >= 0 && cpt < cptab->ctb_nparts);
}
EXPORT_SYMBOL(cfs_cpt_set_cpu);
}
EXPORT_SYMBOL(cfs_cpt_set_cpu);
-void
-cfs_cpt_unset_cpu(struct cfs_cpt_table *cptab, int cpt, int cpu)
+void cfs_cpt_unset_cpu(struct cfs_cpt_table *cptab, int cpt, int cpu)
{
LASSERT(cpt == CFS_CPT_ANY || (cpt >= 0 && cpt < cptab->ctb_nparts));
{
LASSERT(cpt == CFS_CPT_ANY || (cpt >= 0 && cpt < cptab->ctb_nparts));
}
EXPORT_SYMBOL(cfs_cpt_unset_cpu);
}
EXPORT_SYMBOL(cfs_cpt_unset_cpu);
-int
-cfs_cpt_set_cpumask(struct cfs_cpt_table *cptab, int cpt, const cpumask_t *mask)
+int cfs_cpt_set_cpumask(struct cfs_cpt_table *cptab, int cpt,
+ const cpumask_t *mask)
}
EXPORT_SYMBOL(cfs_cpt_set_cpumask);
}
EXPORT_SYMBOL(cfs_cpt_set_cpumask);
-void
-cfs_cpt_unset_cpumask(struct cfs_cpt_table *cptab, int cpt,
- const cpumask_t *mask)
+void cfs_cpt_unset_cpumask(struct cfs_cpt_table *cptab, int cpt,
+ const cpumask_t *mask)
}
EXPORT_SYMBOL(cfs_cpt_unset_cpumask);
}
EXPORT_SYMBOL(cfs_cpt_unset_cpumask);
-int
-cfs_cpt_set_node(struct cfs_cpt_table *cptab, int cpt, int node)
+int cfs_cpt_set_node(struct cfs_cpt_table *cptab, int cpt, int node)
{
const cpumask_t *mask;
int cpu;
{
const cpumask_t *mask;
int cpu;
}
EXPORT_SYMBOL(cfs_cpt_set_node);
}
EXPORT_SYMBOL(cfs_cpt_set_node);
-void
-cfs_cpt_unset_node(struct cfs_cpt_table *cptab, int cpt, int node)
+void cfs_cpt_unset_node(struct cfs_cpt_table *cptab, int cpt, int node)
{
const cpumask_t *mask;
int cpu;
{
const cpumask_t *mask;
int cpu;
}
EXPORT_SYMBOL(cfs_cpt_unset_node);
}
EXPORT_SYMBOL(cfs_cpt_unset_node);
-int
-cfs_cpt_set_nodemask(struct cfs_cpt_table *cptab, int cpt, nodemask_t *mask)
+int cfs_cpt_set_nodemask(struct cfs_cpt_table *cptab, int cpt,
+ const nodemask_t *mask)
}
EXPORT_SYMBOL(cfs_cpt_set_nodemask);
}
EXPORT_SYMBOL(cfs_cpt_set_nodemask);
-void
-cfs_cpt_unset_nodemask(struct cfs_cpt_table *cptab, int cpt, nodemask_t *mask)
+void cfs_cpt_unset_nodemask(struct cfs_cpt_table *cptab, int cpt,
+ const nodemask_t *mask)
}
EXPORT_SYMBOL(cfs_cpt_spread_node);
}
EXPORT_SYMBOL(cfs_cpt_spread_node);
-int
-cfs_cpt_current(struct cfs_cpt_table *cptab, int remap)
+int cfs_cpt_current(struct cfs_cpt_table *cptab, int remap)
- int cpu = smp_processor_id();
- int cpt = cptab->ctb_cpu2cpt[cpu];
+ int cpu = smp_processor_id();
+ int cpt = cptab->ctb_cpu2cpt[cpu];
if (cpt < 0) {
if (!remap)
if (cpt < 0) {
if (!remap)
}
EXPORT_SYMBOL(cfs_cpt_current);
}
EXPORT_SYMBOL(cfs_cpt_current);
-int
-cfs_cpt_of_cpu(struct cfs_cpt_table *cptab, int cpu)
+int cfs_cpt_of_cpu(struct cfs_cpt_table *cptab, int cpu)
{
LASSERT(cpu >= 0 && cpu < nr_cpu_ids);
{
LASSERT(cpu >= 0 && cpu < nr_cpu_ids);
}
EXPORT_SYMBOL(cfs_cpt_of_cpu);
}
EXPORT_SYMBOL(cfs_cpt_of_cpu);
-int
-cfs_cpt_of_node(struct cfs_cpt_table *cptab, int node)
+int cfs_cpt_of_node(struct cfs_cpt_table *cptab, int node)
{
if (node < 0 || node > nr_node_ids)
return CFS_CPT_ANY;
{
if (node < 0 || node > nr_node_ids)
return CFS_CPT_ANY;
}
EXPORT_SYMBOL(cfs_cpt_of_node);
}
EXPORT_SYMBOL(cfs_cpt_of_node);
-int
-cfs_cpt_bind(struct cfs_cpt_table *cptab, int cpt)
+int cfs_cpt_bind(struct cfs_cpt_table *cptab, int cpt)
{
cpumask_t *cpumask;
nodemask_t *nodemask;
{
cpumask_t *cpumask;
nodemask_t *nodemask;
* Choose max to \a number CPUs from \a node and set them in \a cpt.
* We always prefer to choose CPU in the same core/socket.
*/
* Choose max to \a number CPUs from \a node and set them in \a cpt.
* We always prefer to choose CPU in the same core/socket.
*/
-static int
-cfs_cpt_choose_ncpus(struct cfs_cpt_table *cptab, int cpt,
- cpumask_t *node, int number)
+static int cfs_cpt_choose_ncpus(struct cfs_cpt_table *cptab, int cpt,
+ cpumask_t *node, int number)
- cpumask_t *socket = NULL;
- cpumask_t *core = NULL;
- int rc = 0;
- int cpu;
+ cpumask_t *socket = NULL;
+ cpumask_t *core = NULL;
+ int rc = 0;
+ int cpu;
+ int i;
LASSERT(!cpumask_empty(socket));
while (!cpumask_empty(socket)) {
LASSERT(!cpumask_empty(socket));
while (!cpumask_empty(socket)) {
/* get cpumask for hts in the same core */
cpumask_copy(core, topology_sibling_cpumask(cpu));
cpumask_and(core, core, node);
/* get cpumask for hts in the same core */
cpumask_copy(core, topology_sibling_cpumask(cpu));
cpumask_and(core, core, node);
-#define CPT_WEIGHT_MIN 4u
+#define CPT_WEIGHT_MIN 4
-static unsigned int
-cfs_cpt_num_estimate(void)
+static int cfs_cpt_num_estimate(void)
- unsigned nnode = num_online_nodes();
- unsigned ncpu = num_online_cpus();
- unsigned ncpt;
+ int nnode = num_online_nodes();
+ int ncpu = num_online_cpus();
+ int ncpt;
if (ncpu <= CPT_WEIGHT_MIN) {
ncpt = 1;
if (ncpu <= CPT_WEIGHT_MIN) {
ncpt = 1;
#if (BITS_PER_LONG == 32)
/* config many CPU partitions on 32-bit system could consume
* too much memory */
#if (BITS_PER_LONG == 32)
/* config many CPU partitions on 32-bit system could consume
* too much memory */
#endif
while (ncpu % ncpt != 0)
ncpt--; /* worst case is 1 */
#endif
while (ncpu % ncpt != 0)
ncpt--; /* worst case is 1 */
-static struct cfs_cpt_table *
-cfs_cpt_table_create(int ncpt)
+static struct cfs_cpt_table *cfs_cpt_table_create(int ncpt)
{
struct cfs_cpt_table *cptab = NULL;
{
struct cfs_cpt_table *cptab = NULL;
- cpumask_t *mask = NULL;
- int cpt = 0;
- int num;
- int rc;
- int i;
+ cpumask_t *mask = NULL;
+ int cpt = 0;
+ int num;
+ int rc;
+ int i;
rc = cfs_cpt_num_estimate();
if (ncpt <= 0)
rc = cfs_cpt_num_estimate();
if (ncpt <= 0)
while (!cpumask_empty(mask)) {
struct cfs_cpu_partition *part;
while (!cpumask_empty(mask)) {
struct cfs_cpu_partition *part;
/* Each emulated NUMA node has all allowed CPUs in
* the mask.
/* Each emulated NUMA node has all allowed CPUs in
* the mask.
}
#ifdef CONFIG_HOTPLUG_CPU
}
#ifdef CONFIG_HOTPLUG_CPU
-static int
-cfs_cpu_notify(struct notifier_block *self, unsigned long action, void *hcpu)
+static int cfs_cpu_notify(struct notifier_block *self, unsigned long action,
+ void *hcpu)
- unsigned int cpu = (unsigned long)hcpu;
- bool warn;
+ int cpu = (unsigned long)hcpu;
+ bool warn;
switch (action) {
case CPU_DEAD:
switch (action) {
case CPU_DEAD:
-void
-cfs_cpu_fini(void)
{
if (cfs_cpt_table != NULL)
cfs_cpt_table_free(cfs_cpt_table);
{
if (cfs_cpt_table != NULL)
cfs_cpt_table_free(cfs_cpt_table);
{
LASSERT(cfs_cpt_table == NULL);
{
LASSERT(cfs_cpt_table == NULL);