aboutsummaryrefslogtreecommitdiffstats
path: root/lib/cpumask.c
diff options
context:
space:
mode:
authorMike Travis <travis@sgi.com>2008-12-19 01:26:52 -0500
committerRusty Russell <rusty@rustcorp.com.au>2008-12-19 01:26:52 -0500
commitec26b805879c7e77865b39ee91b737985e80006d (patch)
treed5d5c06c81ff7ed21b061b7d42cfe77d4de8a90b /lib/cpumask.c
parent7b4967c532045a1983d6d4af5c69cc7c5109f62b (diff)
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)
Diffstat (limited to 'lib/cpumask.c')
-rw-r--r--lib/cpumask.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/lib/cpumask.c b/lib/cpumask.c
index 3f258f58c85b..a24edf137f41 100644
--- a/lib/cpumask.c
+++ b/lib/cpumask.c
@@ -76,6 +76,20 @@ int cpumask_any_but(const struct cpumask *mask, unsigned int cpu)
76 76
77/* These are not inline because of header tangles. */ 77/* These are not inline because of header tangles. */
78#ifdef CONFIG_CPUMASK_OFFSTACK 78#ifdef CONFIG_CPUMASK_OFFSTACK
79/**
80 * alloc_cpumask_var_node - allocate a struct cpumask on a given node
81 * @mask: pointer to cpumask_var_t where the cpumask is returned
82 * @flags: GFP_ flags
83 *
84 * Only defined when CONFIG_CPUMASK_OFFSTACK=y, otherwise is
85 * a nop returning a constant 1 (in <linux/cpumask.h>)
86 * Returns TRUE if memory allocation succeeded, FALSE otherwise.
87 *
88 * In addition, mask will be NULL if this fails. Note that gcc is
89 * usually smart enough to know that mask can never be NULL if
90 * CONFIG_CPUMASK_OFFSTACK=n, so does code elimination in that case
91 * too.
92 */
79bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node) 93bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node)
80{ 94{
81 if (likely(slab_is_available())) 95 if (likely(slab_is_available()))
@@ -97,23 +111,52 @@ bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node)
97} 111}
98EXPORT_SYMBOL(alloc_cpumask_var_node); 112EXPORT_SYMBOL(alloc_cpumask_var_node);
99 113
114/**
115 * alloc_cpumask_var - allocate a struct cpumask
116 * @mask: pointer to cpumask_var_t where the cpumask is returned
117 * @flags: GFP_ flags
118 *
119 * Only defined when CONFIG_CPUMASK_OFFSTACK=y, otherwise is
120 * a nop returning a constant 1 (in <linux/cpumask.h>).
121 *
122 * See alloc_cpumask_var_node.
123 */
100bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags) 124bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags)
101{ 125{
102 return alloc_cpumask_var_node(mask, flags, numa_node_id()); 126 return alloc_cpumask_var_node(mask, flags, numa_node_id());
103} 127}
104EXPORT_SYMBOL(alloc_cpumask_var); 128EXPORT_SYMBOL(alloc_cpumask_var);
105 129
130/**
131 * alloc_bootmem_cpumask_var - allocate a struct cpumask from the bootmem arena.
132 * @mask: pointer to cpumask_var_t where the cpumask is returned
133 *
134 * Only defined when CONFIG_CPUMASK_OFFSTACK=y, otherwise is
135 * a nop returning a constant 1 (in <linux/cpumask.h>)
136 * Either returns an allocated (zero-filled) cpumask, or causes the
137 * system to panic.
138 */
106void __init alloc_bootmem_cpumask_var(cpumask_var_t *mask) 139void __init alloc_bootmem_cpumask_var(cpumask_var_t *mask)
107{ 140{
108 *mask = alloc_bootmem(cpumask_size()); 141 *mask = alloc_bootmem(cpumask_size());
109} 142}
110 143
144/**
145 * free_cpumask_var - frees memory allocated for a struct cpumask.
146 * @mask: cpumask to free
147 *
148 * This is safe on a NULL mask.
149 */
111void free_cpumask_var(cpumask_var_t mask) 150void free_cpumask_var(cpumask_var_t mask)
112{ 151{
113 kfree(mask); 152 kfree(mask);
114} 153}
115EXPORT_SYMBOL(free_cpumask_var); 154EXPORT_SYMBOL(free_cpumask_var);
116 155
156/**
157 * free_bootmem_cpumask_var - frees result of alloc_bootmem_cpumask_var
158 * @mask: cpumask to free
159 */
117void __init free_bootmem_cpumask_var(cpumask_var_t mask) 160void __init free_bootmem_cpumask_var(cpumask_var_t mask)
118{ 161{
119 free_bootmem((unsigned long)mask, cpumask_size()); 162 free_bootmem((unsigned long)mask, cpumask_size());