lkml.org 
[lkml]   [2019]   [Aug]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v1] drivers/base/memory.c: Don't store end_section_nr in memory blocks
From
Date
On 31.07.19 22:57, Andrew Morton wrote:
> On Wed, 31 Jul 2019 14:22:13 +0200 David Hildenbrand <david@redhat.com> wrote:
>
>> Each memory block spans the same amount of sections/pages/bytes. The size
>> is determined before the first memory block is created. No need to store
>> what we can easily calculate - and the calculations even look simpler now.
>>
>> While at it, fix the variable naming in register_mem_sect_under_node() -
>> we no longer talk about a single section.
>>
>> ...
>>
>> --- a/include/linux/memory.h
>> +++ b/include/linux/memory.h
>> @@ -40,6 +39,8 @@ int arch_get_memory_phys_device(unsigned long start_pfn);
>> unsigned long memory_block_size_bytes(void);
>> int set_memory_block_size_order(unsigned int order);
>>
>> +#define PAGES_PER_MEMORY_BLOCK (memory_block_size_bytes() / PAGE_SIZE)
>
> Please let's not hide function calls inside macros which look like
> compile-time constants! Adding "()" to the macro would be a bit
> better. Making it a regular old inline C function would be better
> still. But I'd suggest just open-coding this at the macro's single
> callsite.
>

Sure, makes sense. Thanks!

--

Thanks,

David / dhildenb

\
 
 \ /
  Last update: 2019-08-01 08:48    [W:0.140 / U:0.144 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site