cpumask: documentation for cpumask_var_t

Impact: New kerneldoc comments

Additional documentation added to all the alloc_cpumask and free_cpumask
functions.

Signed-off-by: Mike Travis <travis@sgi.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (minor additions)
This commit is contained in:
Mike Travis 2008-12-19 16:56:52 +10:30 committed by Rusty Russell
parent 7b4967c532
commit ec26b80587
1 changed files with 43 additions and 0 deletions

View File

@ -76,6 +76,20 @@ int cpumask_any_but(const struct cpumask *mask, unsigned int cpu)
/* These are not inline because of header tangles. */ /* These are not inline because of header tangles. */
#ifdef CONFIG_CPUMASK_OFFSTACK #ifdef CONFIG_CPUMASK_OFFSTACK
/**
* alloc_cpumask_var_node - allocate a struct cpumask on a given node
* @mask: pointer to cpumask_var_t where the cpumask is returned
* @flags: GFP_ flags
*
* Only defined when CONFIG_CPUMASK_OFFSTACK=y, otherwise is
* a nop returning a constant 1 (in <linux/cpumask.h>)
* Returns TRUE if memory allocation succeeded, FALSE otherwise.
*
* In addition, mask will be NULL if this fails. Note that gcc is
* usually smart enough to know that mask can never be NULL if
* CONFIG_CPUMASK_OFFSTACK=n, so does code elimination in that case
* too.
*/
bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node) bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node)
{ {
if (likely(slab_is_available())) if (likely(slab_is_available()))
@ -97,23 +111,52 @@ bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node)
} }
EXPORT_SYMBOL(alloc_cpumask_var_node); EXPORT_SYMBOL(alloc_cpumask_var_node);
/**
* alloc_cpumask_var - allocate a struct cpumask
* @mask: pointer to cpumask_var_t where the cpumask is returned
* @flags: GFP_ flags
*
* Only defined when CONFIG_CPUMASK_OFFSTACK=y, otherwise is
* a nop returning a constant 1 (in <linux/cpumask.h>).
*
* See alloc_cpumask_var_node.
*/
bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags) bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags)
{ {
return alloc_cpumask_var_node(mask, flags, numa_node_id()); return alloc_cpumask_var_node(mask, flags, numa_node_id());
} }
EXPORT_SYMBOL(alloc_cpumask_var); EXPORT_SYMBOL(alloc_cpumask_var);
/**
* alloc_bootmem_cpumask_var - allocate a struct cpumask from the bootmem arena.
* @mask: pointer to cpumask_var_t where the cpumask is returned
*
* Only defined when CONFIG_CPUMASK_OFFSTACK=y, otherwise is
* a nop returning a constant 1 (in <linux/cpumask.h>)
* Either returns an allocated (zero-filled) cpumask, or causes the
* system to panic.
*/
void __init alloc_bootmem_cpumask_var(cpumask_var_t *mask) void __init alloc_bootmem_cpumask_var(cpumask_var_t *mask)
{ {
*mask = alloc_bootmem(cpumask_size()); *mask = alloc_bootmem(cpumask_size());
} }
/**
* free_cpumask_var - frees memory allocated for a struct cpumask.
* @mask: cpumask to free
*
* This is safe on a NULL mask.
*/
void free_cpumask_var(cpumask_var_t mask) void free_cpumask_var(cpumask_var_t mask)
{ {
kfree(mask); kfree(mask);
} }
EXPORT_SYMBOL(free_cpumask_var); EXPORT_SYMBOL(free_cpumask_var);
/**
* free_bootmem_cpumask_var - frees result of alloc_bootmem_cpumask_var
* @mask: cpumask to free
*/
void __init free_bootmem_cpumask_var(cpumask_var_t mask) void __init free_bootmem_cpumask_var(cpumask_var_t mask)
{ {
free_bootmem((unsigned long)mask, cpumask_size()); free_bootmem((unsigned long)mask, cpumask_size());