nodemask_t *ctb_nodemask;
};
+extern struct cfs_cpt_table *cfs_cpt_tab;
+
/**
* return cpumask of CPU partition \a cpt
*/
*/
int cfs_cpu_ht_nsiblings(int cpu);
+int cfs_cpu_init(void);
+void cfs_cpu_fini(void);
+
#else /* !CONFIG_SMP */
-struct cfs_cpt_table {
- /* # of CPU partitions */
- int ctb_nparts;
- /* cpu mask */
- cpumask_t ctb_mask;
- /* node mask */
- nodemask_t ctb_nodemask;
- /* version */
- u64 ctb_version;
-};
+struct cfs_cpt_table;
+#define cfs_cpt_tab ((struct cfs_cpt_table *)NULL)
static inline cpumask_var_t *
cfs_cpt_cpumask(struct cfs_cpt_table *cptab, int cpt)
static inline nodemask_t *
cfs_cpt_nodemask(struct cfs_cpt_table *cptab, int cpt)
{
- return &cptab->ctb_nodemask;
+ return NULL;
}
static inline int
{
return 0;
}
-#endif /* CONFIG_SMP */
-extern struct cfs_cpt_table *cfs_cpt_tab;
+static inline int
+cfs_cpu_init(void)
+{
+ return 0;
+}
+
+static inline void cfs_cpu_fini(void)
+{
+}
+
+#endif /* CONFIG_SMP */
/**
* destroy a CPU partition table
#define cfs_cpt_for_each(i, cptab) \
for (i = 0; i < cfs_cpt_number(cptab); i++)
-int cfs_cpu_init(void);
-void cfs_cpu_fini(void);
-
#endif /* __LIBCFS_CPU_H__ */
#include <linux/sched.h>
#include <linux/libcfs/libcfs.h>
-#ifdef CONFIG_SMP
/**
* modparam for setting number of partitions
*
/* scratch buffer for set/unset_node */
cpumask_var_t cpt_cpumask;
} cpt_data;
-#endif
#define CFS_CPU_VERSION_MAGIC 0xbabecafe
-#ifdef CONFIG_SMP
struct cfs_cpt_table *
cfs_cpt_table_alloc(unsigned int ncpt)
{
cfs_cpt_table_free(cptab);
return NULL;
}
-#else /* ! CONFIG_SMP */
-struct cfs_cpt_table *
-cfs_cpt_table_alloc(unsigned int ncpt)
-{
- struct cfs_cpt_table *cptab;
-
- if (ncpt != 1) {
- CERROR("Can't support cpu partition number %d\n", ncpt);
- return NULL;
- }
-
- cptab = kzalloc(sizeof(*cptab), GFP_NOFS);
- if (cptab) {
- cptab->ctb_version = CFS_CPU_VERSION_MAGIC;
- node_set(0, cptab->ctb_nodemask);
- cptab->ctb_nparts = ncpt;
- }
-
- return cptab;
-}
-#endif /* CONFIG_SMP */
EXPORT_SYMBOL(cfs_cpt_table_alloc);
-#ifdef CONFIG_SMP
void
cfs_cpt_table_free(struct cfs_cpt_table *cptab)
{
kfree(cptab);
}
-#else /* ! CONFIG_SMP */
-void
-cfs_cpt_table_free(struct cfs_cpt_table *cptab)
-{
- LASSERT(cptab->ctb_version == CFS_CPU_VERSION_MAGIC);
-
- kfree(cptab);
-}
-#endif /* CONFIG_SMP */
EXPORT_SYMBOL(cfs_cpt_table_free);
-#ifdef CONFIG_SMP
int
cfs_cpt_table_print(struct cfs_cpt_table *cptab, char *buf, int len)
{
return tmp - buf;
}
EXPORT_SYMBOL(cfs_cpt_table_print);
-#endif /* CONFIG_SMP */
-#ifdef CONFIG_SMP
static void
cfs_node_to_cpumask(int node, cpumask_t *mask)
{
}
EXPORT_SYMBOL(cfs_cpt_bind);
-#endif
-
-#ifdef CONFIG_SMP
-
/**
* 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.
cfs_cpu_fini();
return ret;
}
-
-#else /* ! CONFIG_SMP */
-
-void
-cfs_cpu_fini(void)
-{
- if (cfs_cpt_tab) {
- cfs_cpt_table_free(cfs_cpt_tab);
- cfs_cpt_tab = NULL;
- }
-}
-
-int
-cfs_cpu_init(void)
-{
- cfs_cpt_tab = cfs_cpt_table_alloc(1);
-
- return cfs_cpt_tab ? 0 : -1;
-}
-
-#endif /* CONFIG_SMP */