Skip to content

Commit

Permalink
cpumask: new API, v2
Browse files Browse the repository at this point in the history
- add cpumask_of()
- add free_bootmem_cpumask_var()

Signed-off-by: Rusty Russell <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
rustyrussell authored and Ingo Molnar committed Nov 7, 2008
1 parent 2d3854a commit cd83e42
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
11 changes: 11 additions & 0 deletions include/linux/cpumask.h
Original file line number Diff line number Diff line change
Expand Up @@ -893,6 +893,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
Expand Down Expand Up @@ -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];
Expand All @@ -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. */
Expand Down
5 changes: 5 additions & 0 deletions lib/cpumask.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit cd83e42

Please sign in to comment.