]> asedeno.scripts.mit.edu Git - linux.git/commit
MIPS: Fix max_low_pfn with disabled highmem
authorJames Hogan <james.hogan@imgtec.com>
Tue, 1 Nov 2016 13:59:09 +0000 (13:59 +0000)
committerRalf Baechle <ralf@linux-mips.org>
Fri, 4 Nov 2016 00:45:22 +0000 (01:45 +0100)
commit16a767ec63167ef70c056795782d6c9c76ba5a5c
treed27dd0609ffa8a8b45c268cb06b54b4d38b0d445
parentf92722dc4545ebfa0f99a2f986fd88c112a22a42
MIPS: Fix max_low_pfn with disabled highmem

When low memory doesn't reach HIGHMEM_START (e.g. up to 256MB at PA=0 is
common) and highmem is present above HIGHMEM_START (e.g. on Malta the
RAM overlayed by the IO region is aliased at PA=0x90000000), max_low_pfn
will be initially calculated very large and then clipped down to
HIGHMEM_START.

This causes crashes when reading /sys/kernel/mm/page_idle/bitmap
(i.e. CONFIG_IDLE_PAGE_TRACKING=y) when highmem is disabled. pfn_valid()
will compare against max_mapnr which is derived from max_low_pfn when
there is no highend_pfn set up, and will return true for PFNs right up
to HIGHMEM_START, even though they are beyond the end of low memory and
no page structs will actually exist for these PFNs.

This is fixed by skipping high memory regions when initially calculating
max_low_pfn if highmem is disabled, so it doesn't get clipped too high.
We also clip regions which overlap the highmem boundary when highmem is
disabled, so that max_pfn doesn't extend into highmem either.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/14490/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/kernel/setup.c