Re: [PATCH v7 02/12] mm/sparsemem: Introduce common definitions for the size and mask of a section

From: Oscar Salvador
Date: Fri May 03 2019 - 04:06:54 EST


On Wed, May 01, 2019 at 10:55:32PM -0700, Dan Williams wrote:
> Up-level the local section size and mask from kernel/memremap.c to
> global definitions. These will be used by the new sub-section hotplug
> support.
>
> Cc: Michal Hocko <mhocko@xxxxxxxx>
> Cc: Vlastimil Babka <vbabka@xxxxxxx>
> Cc: Jérôme Glisse <jglisse@xxxxxxxxxx>
> Cc: Logan Gunthorpe <logang@xxxxxxxxxxxx>
> Signed-off-by: Dan Williams <dan.j.williams@xxxxxxxxx>
> ---
> include/linux/mmzone.h | 2 ++
> kernel/memremap.c | 10 ++++------
> mm/hmm.c | 2 --
> 3 files changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
> index f0bbd85dc19a..6726fc175b51 100644
> --- a/include/linux/mmzone.h
> +++ b/include/linux/mmzone.h
> @@ -1134,6 +1134,8 @@ static inline unsigned long early_pfn_to_nid(unsigned long pfn)
> * PFN_SECTION_SHIFT pfn to/from section number
> */
> #define PA_SECTION_SHIFT (SECTION_SIZE_BITS)
> +#define PA_SECTION_SIZE (1UL << PA_SECTION_SHIFT)
> +#define PA_SECTION_MASK (~(PA_SECTION_SIZE-1))

As discussed here [1], we do not need the new PA_SECTION_MASK if we work with
pfns/pages directly, so I'd drop it if you go that way.

Besides that:

Reviewed-by: Oscar Salvador <osalvador@xxxxxxx>

[1] https://patchwork.kernel.org/patch/10926047/

--
Oscar Salvador
SUSE L3