[PATCH] cpumask: new API, v2
From: Rusty Russell
Date: Thu Nov 06 2008 - 19:12:29 EST
- add cpumask_of()
- add free_bootmem_cpumask_var()
Signed-off-by: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
Signed-off-by: Ingo Molnar <mingo@xxxxxxx>
---
include/linux/cpumask.h | 11 +++++++++++
lib/cpumask.c | 5 +++++
2 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index c8e6661..31caa1b 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -894,6 +894,12 @@ static inline void cpumask_copy(struct cpumask *dstp,
#define cpumask_any_and(mask1, mask2) cpumask_first_and((mask1), (mask2))
/**
+ * cpumask_of - the cpumask containing just a given cpu
+ * @cpu: the cpu (<= nr_cpu_ids)
+ */
+#define cpumask_of(cpu) (get_cpu_mask(cpu))
+
+/**
* to_cpumask - convert an NR_CPUS bitmap to a struct cpumask *
* @bitmap: the bitmap
*
@@ -946,6 +952,7 @@ typedef struct cpumask *cpumask_var_t;
bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags);
void alloc_bootmem_cpumask_var(cpumask_var_t *mask);
void free_cpumask_var(cpumask_var_t mask);
+void free_bootmem_cpumask_var(cpumask_var_t mask);
#else
typedef struct cpumask cpumask_var_t[1];
@@ -962,6 +969,10 @@ static inline void alloc_bootmem_cpumask_var(cpumask_var_t *mask)
static inline void free_cpumask_var(cpumask_var_t mask)
{
}
+
+static inline void free_bootmem_cpumask_var(cpumask_var_t mask)
+{
+}
#endif /* CONFIG_CPUMASK_OFFSTACK */
/* The pointer versions of the maps, these will become the primary versions. */
diff --git a/lib/cpumask.c b/lib/cpumask.c
index 5ceb421..2ebc3a9 100644
--- a/lib/cpumask.c
+++ b/lib/cpumask.c
@@ -107,4 +107,9 @@ void free_cpumask_var(cpumask_var_t mask)
kfree(mask);
}
EXPORT_SYMBOL(free_cpumask_var);
+
+void free_bootmem_cpumask_var(cpumask_var_t mask)
+{
+ free_bootmem((unsigned long)mask, cpumask_size());
+}
#endif
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/