Re: [PATCH 1/1] cpumask: add alloc_cpumask_var_node
From: Stephen Rothwell
Date: Mon Dec 15 2008 - 22:31:17 EST
Hi Mike,
Just some simple comments.
On Mon, 15 Dec 2008 18:32:51 -0800 Mike Travis <travis@xxxxxxx> wrote:
>
> +/**
> + * alloc_cpumask_var - return an allocated struct cpumask
> + * @mask: pointer to cpumask_var_t where the cpumask is returned
> + * @cpu: GFP_ flags
^^^
flags
> + * alloc_cpumask_var_node - return an allocated struct cpumask on a
> + * specific node.
> + * @mask: pointer to cpumask_var_t where the cpumask is returned
> + * @cpu: GFP_ flags
^^^
flags
> + * @node: node to allocate memory on
> + *
> + * 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.
> + */
> +bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node)
> +{
> + if (likely(slab_is_available()))
> + *mask = kmalloc_node(cpumask_size(), flags, node);
> + else {
> +#ifdef CONFIG_DEBUG_PER_CPU_MAPS
> + printk(KERN_ERR
> + "=> alloc_cpumask_var_node: kmalloc not available!\n");
> + dump_stack();
> +#endif
> + *mask = NULL;
> + }
> +#ifdef CONFIG_DEBUG_PER_CPU_MAPS
> + if (!*mask) {
> + printk(KERN_ERR "=> alloc_cpumask_var_node: failed!\n");
> + dump_stack();
> + }
> +#endif
So if !slab_is_available() and CONFIG_DEBUG_PER_CPU_MAPS is set, we get
two stack dumps?
> + * free_cpumask_var - frees memory allocated for a struct cpumask.
> + * mask: cpumask to free
^
missing '@'
> + * free_bootmem_cpumask_var - frees bootmem memory allocated for a struct cpumask.
> + * mask: cpumask to free
^
here as well.
--
Cheers,
Stephen Rothwell sfr@xxxxxxxxxxxxxxxx
http://www.canb.auug.org.au/~sfr/
Attachment:
pgp00000.pgp
Description: PGP signature