Re: [patch 03/41] cpu alloc: Use cpu allocator instead of the builtin modules per cpu allocator

Christoph Lameter
2008-05-30T06:21:18Z

On Fri, 30 May 2008, Rusty Russell wrote:

> Hmm, does cpu_free(NULL, 0) do something? Seems like it shouldn't, for
> symmetry with free().

No it just returns.

> > + percpu = cpu_alloc(size, GFP_KERNEL|__GFP_ZERO, align);
> > + if (!percpu)
> > + printk(KERN_WARNING "Could not allocate %lu bytes percpu data\n",
> > + size);
> > if (!percpu) {
> > err = -ENOMEM;
> > goto free_mod;
>
> OK, we've *never* had a report of the per-cpu alignment message, so I'd be
> happy to pass that through to cpu_alloc() and have it fail. Also, the if
> (!percpu) cases should be combined.

Ack.

> > free_percpu:
> > if (percpu)
> > - percpu_modfree(percpu);
> > + cpu_free(percpu, percpu_size);
>
> As above.

The if can be dropped.

>
> > + goal = __per_cpu_size;
>
> Where did __per_cpu_size come from? I missed it in the earlier patches...

Its __per_cpu_end - __per_cpu_start.