Re: [PATCH mm-unstable] arch, mm: consolidate empty_zero_page

Andreas Larsson
2026-02-09T08:41:19Z

On 2026-02-07 11:36, Mike Rapoport wrote:
>> Unfortunately, that does not help. The LDOM goes down in the same fashion.
>
> Apparently something is wrong with my pointer arithmetics :/
>
> Can you try this one instead?
>
> diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h
> index 74ede706fb32..615f460c50af 100644
> --- a/arch/sparc/include/asm/pgtable_64.h
> +++ b/arch/sparc/include/asm/pgtable_64.h
> @@ -210,6 +210,9 @@ extern unsigned long _PAGE_CACHE;
> extern unsigned long pg_iobits;
> extern unsigned long _PAGE_ALL_SZ_BITS;
>
> +extern struct page *mem_map_zero;
> +#define ZERO_PAGE(vaddr) (mem_map_zero)
> +
> /* PFNs are real physical page numbers. However, mem_map only begins to record
> * per-page information starting at pfn_base. This is to handle systems where
> * the first physical page in the machine is at some huge physical address,
> diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
> index 2bd99944176d..aa1f9f071fb2 100644
> --- a/arch/sparc/mm/init_64.c
> +++ b/arch/sparc/mm/init_64.c
> @@ -177,6 +177,9 @@ extern unsigned long sparc_ramdisk_image64;
> extern unsigned int sparc_ramdisk_image;
> extern unsigned int sparc_ramdisk_size;
>
> +struct page *mem_map_zero __read_mostly;
> +EXPORT_SYMBOL(mem_map_zero);
> +
> unsigned int sparc64_highest_unlocked_tlb_ent __read_mostly;
>
> unsigned long sparc64_kern_pri_context __read_mostly;
> @@ -2495,6 +2498,9 @@ static void __init register_page_bootmem_info(void)
> }
> void __init mem_init(void)
> {
> + phys_addr_t zero_page_pa = kern_base +
> + ((unsigned long)&empty_zero_page[0] - KERNBASE);
> +
> /*
> * Must be done after boot memory is put on freelist, because here we
> * might set fields in deferred struct pages that have not yet been
> @@ -2503,6 +2509,12 @@ void __init mem_init(void)
> */
> register_page_bootmem_info();
>
> + /*
> + * Set up the zero page, mark it reserved, so that page count
> + * is not manipulated when freeing the page from user ptes.
> + */
> + mem_map_zero = pfn_to_page(PHYS_PFN(zero_page_pa));
> +
> if (tlb_type == cheetah || tlb_type == cheetah_plus)
> cheetah_ecache_flush_init();
> }
>

With that one, things work fine.

Cheers,
Andreas