#include <linux/cpu.h>
#include <linux/sched.h>
-#include <libcfs/libcfs_cpu.h>
#include <libcfs/libcfs.h>
+#include <libcfs/libcfs_cpu.h>
+
+/** virtual processing unit */
+struct cfs_cpu_partition {
+ /* CPUs mask for this partition */
+ cpumask_var_t cpt_cpumask;
+ /* nodes mask for this partition */
+ nodemask_t *cpt_nodemask;
+ /* NUMA distance between CPTs */
+ unsigned int *cpt_distance;
+ /* spread rotor for NUMA allocator */
+ unsigned int cpt_spread_rotor;
+ /* NUMA node if cpt_nodemask is empty */
+ int cpt_node;
+};
+
+/** descriptor for CPU partitions */
+struct cfs_cpt_table {
+ /* spread rotor for NUMA allocator */
+ unsigned int ctb_spread_rotor;
+ /* maximum NUMA distance between all nodes in table */
+ unsigned int ctb_distance;
+ /* # of CPU partitions */
+ int ctb_nparts;
+ /* partitions tables */
+ struct cfs_cpu_partition *ctb_parts;
+ /* shadow HW CPU to CPU partition ID */
+ int *ctb_cpu2cpt;
+ /* all cpus in this partition table */
+ cpumask_var_t ctb_cpumask;
+ /* shadow HW node to CPU partition ID */
+ int *ctb_node2cpt;
+ /* all nodes in this partition table */
+ nodemask_t *ctb_nodemask;
+};
/** Global CPU partition table */
struct cfs_cpt_table *cfs_cpt_tab __read_mostly;
module_param(cpu_pattern, charp, 0444);
MODULE_PARM_DESC(cpu_pattern, "CPU partitions pattern");
-#ifdef CONFIG_SMP
struct cfs_cpt_table *cfs_cpt_table_alloc(int ncpt)
{
struct cfs_cpt_table *cptab;
{
nodemask_t *mask;
int weight;
- int rotor;
+ unsigned int rotor;
int node = 0;
/* convert CPU partition ID to HW node id */
#endif /* CONFIG_HOTPLUG_CPU */
return ret;
}
-
-#else /* ! CONFIG_SMP */
-
-struct cfs_cpt_table *cfs_cpt_table_alloc(int ncpt)
-{
- struct cfs_cpt_table *cptab;
-
- if (ncpt != 1) {
- CERROR("Can't support cpu partition number %d\n", ncpt);
- return NULL;
- }
-
- LIBCFS_ALLOC(cptab, sizeof(*cptab));
- if (!cptab)
- return NULL;
-
- cpumask_set_cpu(0, cptab->ctb_cpumask);
- node_set(0, cptab->ctb_nodemask);
-
- return cptab;
-}
-EXPORT_SYMBOL(cfs_cpt_table_alloc);
-
-int cfs_cpt_table_print(struct cfs_cpt_table *cptab, char *buf, int len)
-{
- int rc;
-
- rc = snprintf(buf, len, "0\t: 0\n");
- len -= rc;
- if (len <= 0)
- return -EFBIG;
-
- return rc;
-}
-EXPORT_SYMBOL(cfs_cpt_table_print);
-
-int cfs_cpt_distance_print(struct cfs_cpt_table *cptab, char *buf, int len)
-{
- int rc;
-
- rc = snprintf(buf, len, "0\t: 0:1\n");
- len -= rc;
- if (len <= 0)
- return -EFBIG;
-
- return rc;
-}
-EXPORT_SYMBOL(cfs_cpt_distance_print);
-
-void cfs_cpu_fini(void)
-{
- if (cfs_cpt_table) {
- cfs_cpt_table_free(cfs_cpt_table);
- cfs_cpt_table = NULL;
- }
-}
-
-int cfs_cpu_init(void)
-{
- cfs_cpt_table = cfs_cpt_table_alloc(1);
-
- return cfs_cpt_table ? 0 : -1;
-}
-
-#endif /* !CONFIG_SMP */