Re: [PATCH UPDATED] percpu: use dynamic percpu allocator as the default percpu allocator

Matthew Wilcox
2009-04-01T22:58:27Z

On Thu, Apr 02, 2009 at 12:32:41AM +0200, Ingo Molnar wrote:
> And free_percpu(NULL) does this:
>
> void free_percpu(void *ptr)
> {
> void *addr = __pcpu_ptr_to_addr(ptr);
> struct pcpu_chunk *chunk;
> unsigned long flags;
> int off;
>
> if (!ptr)
> return;

Why don't we rewrite this as:

- void *addr = __pcpu_ptr_to_addr(ptr);
+ void *addr;
...
if (!ptr)
return;
addr = __pcpu_ptr_to_addr(ptr);

if kfree(NULL) is really that important, we should avoid doing this
extra work, not just rely on the variable being cache-hot.

--
Matthew Wilcox Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."