ARC: Use max_high_pfn as a HIGHMEM zone border
PATCH v2 1/1 ARC: Use max_high_pfn as a HIGHMEM zone border
Commit 4af22ded0ecf ("arc: fix memory initialization for systems with two memory banks") fixed highmem, but for the PAE case it causes bug messages:
BUG: Bad page state in process swapper pfn:80000 page:(ptrval) refcount:0 mapcount:1 mapping:00000000 index:0x0 pfn:0x80000 flags: 0x0() raw: 00000000 00000100 00000122 00000000 00000000 00000000 00000000 00000000 raw: 00000000 page dumped because: nonzero mapcount Modules linked in: CPU: 0 PID: 0 Comm: swapper Not tainted 5.12.0-rc5-00003-g1e43c377a79f #1
Stack Trace:
arc_unwind_core+0xe8/0x118
Disabling lock debugging due to kernel taint
This is because the fix expects highmem to be always less than lowmem and uses min_low_pfn as an upper zone border for highmem.
max_high_pfn should be ok for both highmem and highmem+PAE cases.
---
Changes for v2:
- Revised commit message and added comment to code
--- arch/arc/mm/init.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
arch/arc/mm/init.c +10 -1
@@ -157,7 +157,16 @@ void __init setup_arch_memory(void) min_high_pfn =PFN_DOWN (high_mem_start); max_high_pfn =PFN_DOWN (high_mem_start + high_mem_sz); - max_zone_pfn[ZONE_HIGHMEM ] = min_low_pfn; +/* +* max_high_pfn should be ok here for both HIGHMEM and HIGHMEM+PAE. +* For HIGHMEM without PAE max_high_pfn should be less than +* min_low_pfn to guarantee that these two regions don't overlap. +* For PAE case highmem is greater than lowmem, so it is natural +* to use max_high_pfn. +* +* In both cases, holes should be handled by pfn_valid(). +*/ + max_zone_pfn[ZONE_HIGHMEM ] = max_high_pfn; high_memory = (void *)(min_high_pfn <<PAGE_SHIFT );
Signature · 1 line
2.16.2
Vineet Gupta
AppliedQuoted 17 lines · Vladimir Isaev
Commit
4af22ded0ecf("arc: fix memory initialization for systems with two memory banks") fixed highmem, but for the PAE case it causes bug messages:BUG: Bad page state in process swapper pfn:80000 page:(ptrval) refcount:0 mapcount:1 mapping:00000000 index:0x0 pfn:0x80000 flags: 0x0() raw: 00000000 00000100 00000122 00000000 00000000 00000000 00000000 00000000 raw: 00000000 page dumped because: nonzero mapcount Modules linked in: CPU: 0 PID: 0 Comm: swapper Not tainted 5.12.0-rc5-00003-g1e43c377a79f #1Stack Trace:
arc_unwind_core+0xe8/0x118Disabling lock debugging due to kernel taint
Quoted 8 lines
This is because the fix expects highmem to be always less than lowmem and uses
min_low_pfnas an upper zone border for highmem.
max_high_pfnshould be ok for both highmem and highmem+PAE cases.Signed-off-by Vladimir Isaev <[email protected]>Cc Mike Rapoport <[email protected]>Cc Vineet Gupta <[email protected]>
Applied to for-curr.
Thx,
-Vineet
Quoted 29 lines
---
Changes for v2:
- Revised commit message and added comment to code--- arch/arc/mm/init.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)arch/arc/mm/init.c +10
-1@@ -157,7 +157,16 @@ void __init setup_arch_memory(void) min_high_pfn =PFN_DOWN (high_mem_start); max_high_pfn =PFN_DOWN (high_mem_start + high_mem_sz); - max_zone_pfn[ZONE_HIGHMEM ] = min_low_pfn; +/* +* max_high_pfn should be ok here for both HIGHMEM and HIGHMEM+PAE. +* For HIGHMEM without PAE max_high_pfn should be less than +* min_low_pfn to guarantee that these two regions don't overlap. +* For PAE case highmem is greater than lowmem, so it is natural +* to use max_high_pfn. +* +* In both cases, holes should be handled by pfn_valid(). +*/ + max_zone_pfn[ZONE_HIGHMEM ] = max_high_pfn; high_memory = (void *)(min_high_pfn <<PAGE_SHIFT );