Message ID | 20250325114928.1791109-3-rppt@kernel.org (mailing list archive) |
---|---|
State | Handled Elsewhere |
Headers | show |
Series | mm: fixes for fallouts from mem_init() cleanup | expand |
On Tue, Mar 25, 2025 at 01:49:28PM +0200, Mike Rapoport wrote: > From: "Mike Rapoport (Microsoft)" <rppt@kernel.org> > > Nathan Chancellor reports the following crash on a MIPS system with > CONFIG_HIGHMEM=n: ... > The crash happens because commit 6faea3422e3b ("arch, mm: streamline > HIGHMEM freeing") too eagerly frees high memory to the page allocator even > when HIGHMEM is disabled. > > Make sure that when CONFIG_HIGHMEM=n the high memory is not released to the > page allocator. > > Link: https://lore.kernel.org/all/20250323190647.GA1009914@ax162 > Reported-by: Nathan Chancellor <nathan@kernel.org> > Fixes: 6faea3422e3b ("arch, mm: streamline HIGHMEM freeing") > Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org> Tested-by: Nathan Chancellor <nathan@kernel.org> > --- > mm/memblock.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/mm/memblock.c b/mm/memblock.c > index 64ae678cd1d1..d7ff8dfe5f88 100644 > --- a/mm/memblock.c > +++ b/mm/memblock.c > @@ -2166,6 +2166,9 @@ static unsigned long __init __free_memory_core(phys_addr_t start, > unsigned long start_pfn = PFN_UP(start); > unsigned long end_pfn = PFN_DOWN(end); > > + if (!IS_ENABLED(CONFIG_HIGHMEM) && end_pfn > max_low_pfn) > + end_pfn = max_low_pfn; > + > if (start_pfn >= end_pfn) > return 0; > > -- > 2.47.2 >
diff --git a/mm/memblock.c b/mm/memblock.c index 64ae678cd1d1..d7ff8dfe5f88 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -2166,6 +2166,9 @@ static unsigned long __init __free_memory_core(phys_addr_t start, unsigned long start_pfn = PFN_UP(start); unsigned long end_pfn = PFN_DOWN(end); + if (!IS_ENABLED(CONFIG_HIGHMEM) && end_pfn > max_low_pfn) + end_pfn = max_low_pfn; + if (start_pfn >= end_pfn) return 0;