diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2008-11-06 19:12:29 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-11-07 06:52:30 -0500 |
commit | cd83e42c6b0413dcbb548c2ead799111ff7e6a13 (patch) | |
tree | 0110f8f39a8f88aacfbe4f0692b099373523edc0 | |
parent | 2d3854a37e8b767a51aba38ed6d22817b0631e33 (diff) |
cpumask: new API, v2
- add cpumask_of()
- add free_bootmem_cpumask_var()
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | include/linux/cpumask.h | 11 | ||||
-rw-r--r-- | lib/cpumask.c | 5 |
2 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index c8e66619097b..31caa1bc620a 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h | |||
@@ -894,6 +894,12 @@ static inline void cpumask_copy(struct cpumask *dstp, | |||
894 | #define cpumask_any_and(mask1, mask2) cpumask_first_and((mask1), (mask2)) | 894 | #define cpumask_any_and(mask1, mask2) cpumask_first_and((mask1), (mask2)) |
895 | 895 | ||
896 | /** | 896 | /** |
897 | * cpumask_of - the cpumask containing just a given cpu | ||
898 | * @cpu: the cpu (<= nr_cpu_ids) | ||
899 | */ | ||
900 | #define cpumask_of(cpu) (get_cpu_mask(cpu)) | ||
901 | |||
902 | /** | ||
897 | * to_cpumask - convert an NR_CPUS bitmap to a struct cpumask * | 903 | * to_cpumask - convert an NR_CPUS bitmap to a struct cpumask * |
898 | * @bitmap: the bitmap | 904 | * @bitmap: the bitmap |
899 | * | 905 | * |
@@ -946,6 +952,7 @@ typedef struct cpumask *cpumask_var_t; | |||
946 | bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags); | 952 | bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags); |
947 | void alloc_bootmem_cpumask_var(cpumask_var_t *mask); | 953 | void alloc_bootmem_cpumask_var(cpumask_var_t *mask); |
948 | void free_cpumask_var(cpumask_var_t mask); | 954 | void free_cpumask_var(cpumask_var_t mask); |
955 | void free_bootmem_cpumask_var(cpumask_var_t mask); | ||
949 | 956 | ||
950 | #else | 957 | #else |
951 | typedef struct cpumask cpumask_var_t[1]; | 958 | typedef struct cpumask cpumask_var_t[1]; |
@@ -962,6 +969,10 @@ static inline void alloc_bootmem_cpumask_var(cpumask_var_t *mask) | |||
962 | static inline void free_cpumask_var(cpumask_var_t mask) | 969 | static inline void free_cpumask_var(cpumask_var_t mask) |
963 | { | 970 | { |
964 | } | 971 | } |
972 | |||
973 | static inline void free_bootmem_cpumask_var(cpumask_var_t mask) | ||
974 | { | ||
975 | } | ||
965 | #endif /* CONFIG_CPUMASK_OFFSTACK */ | 976 | #endif /* CONFIG_CPUMASK_OFFSTACK */ |
966 | 977 | ||
967 | /* The pointer versions of the maps, these will become the primary versions. */ | 978 | /* The pointer versions of the maps, these will become the primary versions. */ |
diff --git a/lib/cpumask.c b/lib/cpumask.c index 5ceb4211c834..2ebc3a9a7465 100644 --- a/lib/cpumask.c +++ b/lib/cpumask.c | |||
@@ -107,4 +107,9 @@ void free_cpumask_var(cpumask_var_t mask) | |||
107 | kfree(mask); | 107 | kfree(mask); |
108 | } | 108 | } |
109 | EXPORT_SYMBOL(free_cpumask_var); | 109 | EXPORT_SYMBOL(free_cpumask_var); |
110 | |||
111 | void free_bootmem_cpumask_var(cpumask_var_t mask) | ||
112 | { | ||
113 | free_bootmem((unsigned long)mask, cpumask_size()); | ||
114 | } | ||
110 | #endif | 115 | #endif |