lkml.org 
[lkml]   [2009]   [Apr]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH UPDATED] percpu: use dynamic percpu allocator as the default percpu allocator
Matthew Wilcox wrote:
> 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.

Slightly off-topic but the expectation was that gcc would be smart
enough to optimize it as it sees fit regardless of the actual code
ordering. The access to the global variable being read, there is no
actual difference between the original code and yours. Oh well... at
any rate, I don't think it's at the level we should be optimizing at.

Thanks.

--
tejun


\
 
 \ /
  Last update: 2009-04-02 04:37    [from the cache]
©2003-2011 Jasper Spaans