On 2026-01-11 09:20, Mike Rapoport wrote:
> From: "Mike Rapoport (Microsoft)" <[email protected]>
>
> Move calculations of zone limits to a dedicated arch_zone_limits_init()
> function.
>
> Later MM core will use this function as an architecture specific callback
> during nodes and zones initialization and thus there won't be a need to
> call free_area_init() from every architecture.
>
> Signed-off-by: Mike Rapoport (Microsoft) <[email protected]>
> ---
> arch/sparc/mm/init_64.c | 6 ++++++
> arch/sparc/mm/srmmu.c | 12 ++++++++----
> 2 files changed, 14 insertions(+), 4 deletions(-)
Hi Mike,
Thanks for this nice cleanup series.
> diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
> index df9f7c444c39..fbaad449dfc9 100644
> --- a/arch/sparc/mm/init_64.c
> +++ b/arch/sparc/mm/init_64.c
> @@ -2279,6 +2279,11 @@ static void __init reduce_memory(phys_addr_t limit_ram)
> memblock_enforce_memory_limit(limit_ram);
> }
>
> +void __init arch_zone_limits_init(unsigned long *max_zone_pfns)
> +{
> + max_zone_pfns[ZONE_NORMAL] = last_valid_pfn;
> +}
> +
> void __init paging_init(void)
> {
> unsigned long end_pfn, shift, phys_base;
> @@ -2461,6 +2466,7 @@ void __init paging_init(void)
>
> max_zone_pfns[ZONE_NORMAL] = end_pfn;
This old initialization of max_zone_pfns[ZONE_NORMAL] should also be
removed, right? With that removed it makes the local end_pfn variable
set but unused, so could you please also remove that one?
I know that this whole code block gets removed later, but the cleanup
max_zone_pfns[ZONE_NORMAL] and the removal of end_pfn (that is not done
later in this version of the series) fits logically in this patch.
>
> + arch_zone_limits_init(max_zone_pfns);
> free_area_init(max_zone_pfns);
> }
>
> diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
> index f8fb4911d360..81e90151db90 100644
> --- a/arch/sparc/mm/srmmu.c
> +++ b/arch/sparc/mm/srmmu.c
> @@ -884,6 +884,13 @@ static void __init map_kernel(void)
>
> void (*poke_srmmu)(void) = NULL;
>
> +void __init arch_zone_limits_init(unsigned long *max_zone_pfns)
> +{
> + max_zone_pfns[ZONE_DMA] = max_low_pfn;
> + max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
> + max_zone_pfns[ZONE_HIGHMEM] = highend_pfn;
> +}
> +
> void __init srmmu_paging_init(void)
> {
> int i;
> @@ -967,10 +974,7 @@ void __init srmmu_paging_init(void)
> {
> unsigned long max_zone_pfn[MAX_NR_ZONES] = { 0 };
>
> - max_zone_pfn[ZONE_DMA] = max_low_pfn;
> - max_zone_pfn[ZONE_NORMAL] = max_low_pfn;
> - max_zone_pfn[ZONE_HIGHMEM] = highend_pfn;
> -
> + arch_zone_limits_init(max_zone_pfn);
> free_area_init(max_zone_pfn);
> }
> }
With the feedback for arch/sparc/mm/init_64.c addressed:
Acked-by: Andreas Larsson <[email protected]>
Cheers,
Andreas