From d3c27cb826bcd06db252f03928d2a7da7af2f7a0 Mon Sep 17 00:00:00 2001 From: Russ Anderson Date: Wed, 20 Mar 2013 15:06:47 +1100 Subject: [PATCH] mm: zone_end_pfn is too small Booting with 32 TBytes memory hits BUG at mm/page_alloc.c:552! (output below). The key hint is "page 4294967296 outside zone". 4294967296 = 0x100000000 (bit 32 is set). The problem is in include/linux/mmzone.h: 530 static inline unsigned zone_end_pfn(const struct zone *zone) 531 { 532 return zone->zone_start_pfn + zone->spanned_pages; 533 } zone_end_pfn is "unsigned" (32 bits). Changing it to "unsigned long" (64 bits) fixes the problem. zone_end_pfn() was added recently in commit 108bcc96ef70 ("mm: add & use zone_end_pfn() and zone_spans_pfn()") http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/include/linux/mmzone.h?id=108bcc96ef7047c02cad4d229f04da38186a3f3f Output from the failure. No AGP bridge found page 4294967296 outside zone [ 4294967296 - 4327469056 ] ------------[ cut here ]------------ kernel BUG at mm/page_alloc.c:552! invalid opcode: 0000 [#1] SMP Modules linked in: CPU 0 Pid: 0, comm: swapper Not tainted 3.9.0-rc2.dtp+ #10 RIP: 0010:[] [] free_one_page+0x382/0x430 RSP: 0000:ffffffff81943d98 EFLAGS: 00010002 RAX: 0000000000000001 RBX: ffffea4000000000 RCX: 000000000000b3d9 RDX: 0000000000000000 RSI: 0000000000000086 RDI: 0000000000000046 RBP: ffffffff81943df8 R08: 0000000000000040 R09: 0000000000000023 R10: 00000000000034bf R11: 00000000000034bf R12: ffffea4000000000 R13: ffff981efefd9d80 R14: 0000000000000006 R15: 0000000000000006 FS: 0000000000000000(0000) GS:ffffc90000000000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffffc7defefff000 CR3: 000000000194e000 CR4: 00000000000406b0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 Process swapper (pid: 0, threadinfo ffffffff81942000, task ffffffff81955420) Stack: 00000000000000ff ffffc900000100a0 ffffc900000100d0 ffffffff00000040 0000000000000000 0000000081148809 0000000000000097 ffffea4000000000 0000000000000006 0000000000000002 0000000101e82bc0 ffffea4000001000 Call Trace: [] __free_pages_ok+0x96/0xb0 [] __free_pages+0x25/0x50 [] __free_pages_bootmem+0x8a/0x8c [] __free_memory_core+0xea/0x131 [] free_low_memory_core_early+0x4a/0x98 [] free_all_bootmem+0x45/0x47 [] mem_init+0x7b/0x14c [] start_kernel+0x216/0x433 [] ? repair_env_string+0x5b/0x5b [] x86_64_start_reservations+0x2a/0x2c [] x86_64_start_kernel+0x144/0x153 Code: 89 f1 ba 01 00 00 00 31 f6 d3 e2 4c 89 ef e8 66 a4 01 00 e9 2c fe ff ff 0f 0b eb fe 0f 0b 66 66 2e 0f 1f 84 00 00 00 00 00 eb f3 <0f> 0b eb fe 0f 0b 0f 1f 84 00 00 00 00 00 eb f6 0f 0b eb fe 49 RIP [] free_one_page+0x382/0x430 RSP ---[ end trace a7919e7f17c0a725 ]--- Kernel panic - not syncing: Attempted to kill the idle task! Signed-off-by: Russ Anderson Reported-by: George Beshers Acked-by: Hedi Berriche Cc: Cody P Schafer Cc: Michal Hocko Signed-off-by: Andrew Morton --- include/linux/mmzone.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index ede274957e05..c74092eebf5c 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -527,7 +527,7 @@ static inline int zone_is_oom_locked(const struct zone *zone) return test_bit(ZONE_OOM_LOCKED, &zone->flags); } -static inline unsigned zone_end_pfn(const struct zone *zone) +static inline unsigned long zone_end_pfn(const struct zone *zone) { return zone->zone_start_pfn + zone->spanned_pages; } -- 2.39.5