提交 12710a56 编写于 作者: B Bob Picco 提交者: Linus Torvalds

fix sysrq-m oops

We aren't sampling for holes in memory.  Thus we encounter a section hole
with empty section map pointer for SPARSEMEM and OOPs for show_mem.  This
issue has been seen in 2.6.21, current git and current mm.  The patch below
is for mainline and mm.  It was boot tested for SPARSEMEM, current VMEMMAP
of Andy's in mm ml and DISCONTIGMEM.  A slightly different patch will be
posted to stable for 2.6.21.

Previous to commit f0a5a58a memory_present
was called for node_start_pfn to node_end_pfn.  This would cover the
hole(s) with reserved pages and valid sections.  Most SPARSEMEM supported
arches do a pfn_valid check in show_mem before computing the page structure
address.

This issue was brought to my attention on IRC by Arnaldo Carvalho de Melo.
Thanks to Arnaldo for testing.
Signed-off-by: NBob Picco <bob.picco@hp.com>
Cc: Chuck Ebbert <cebbert@redhat.com>
Cc: Andi Kleen <ak@suse.de>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: NAndy Whitcroft <apw@shadowen.org>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 778e9a9c
...@@ -79,6 +79,8 @@ void show_mem(void) ...@@ -79,6 +79,8 @@ void show_mem(void)
if (unlikely(i % MAX_ORDER_NR_PAGES == 0)) { if (unlikely(i % MAX_ORDER_NR_PAGES == 0)) {
touch_nmi_watchdog(); touch_nmi_watchdog();
} }
if (!pfn_valid(pgdat->node_start_pfn + i))
continue;
page = pfn_to_page(pgdat->node_start_pfn + i); page = pfn_to_page(pgdat->node_start_pfn + i);
total++; total++;
if (PageReserved(page)) if (PageReserved(page))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册