[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190731135715.ddb4fccb5c4ee2f14f84a34a@linux-foundation.org>
Date: Wed, 31 Jul 2019 13:57:15 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: David Hildenbrand <david@...hat.com>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Pavel Tatashin <pasha.tatashin@...een.com>,
Michal Hocko <mhocko@...e.com>,
Dan Williams <dan.j.williams@...el.com>,
Oscar Salvador <osalvador@...e.de>
Subject: Re: [PATCH v1] drivers/base/memory.c: Don't store end_section_nr in
memory blocks
On Wed, 31 Jul 2019 14:22:13 +0200 David Hildenbrand <david@...hat.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.
Powered by blists - more mailing lists