Skip to content

Commit cd83e42

Browse files
rustyrussellIngo Molnar
authored andcommitted
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>
1 parent 2d3854a commit cd83e42

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

include/linux/cpumask.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,12 @@ static inline void cpumask_copy(struct cpumask *dstp,
893893
*/
894894
#define cpumask_any_and(mask1, mask2) cpumask_first_and((mask1), (mask2))
895895

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+
896902
/**
897903
* to_cpumask - convert an NR_CPUS bitmap to a struct cpumask *
898904
* @bitmap: the bitmap
@@ -946,6 +952,7 @@ typedef struct cpumask *cpumask_var_t;
946952
bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags);
947953
void alloc_bootmem_cpumask_var(cpumask_var_t *mask);
948954
void free_cpumask_var(cpumask_var_t mask);
955+
void free_bootmem_cpumask_var(cpumask_var_t mask);
949956

950957
#else
951958
typedef struct cpumask cpumask_var_t[1];
@@ -962,6 +969,10 @@ static inline void alloc_bootmem_cpumask_var(cpumask_var_t *mask)
962969
static inline void free_cpumask_var(cpumask_var_t mask)
963970
{
964971
}
972+
973+
static inline void free_bootmem_cpumask_var(cpumask_var_t mask)
974+
{
975+
}
965976
#endif /* CONFIG_CPUMASK_OFFSTACK */
966977

967978
/* The pointer versions of the maps, these will become the primary versions. */

lib/cpumask.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,9 @@ void free_cpumask_var(cpumask_var_t mask)
107107
kfree(mask);
108108
}
109109
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+
}
110115
#endif

0 commit comments

Comments
 (0)