[PATCH] do not trace unsuccessful __alloc_pages

Jan Kiszka <[email protected]> Tue, 26 Feb 2008 16:09:36 +0100
Newsgroups gmane.linux.kernel.tracing
Message-ID <[email protected]>
We may happen to return from __alloc_pages with page == NULL. As we
neither want to trace this as successful allocation nor want to break
the kernel due to page_to_pfn(NULL), patch below is required.

Signed-off-by: Jan Kiszka <[email protected]>

---
 mm/page_alloc.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: b/mm/page_alloc.c
===================================================================
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1640,7 +1640,9 @@ nopage:
 		show_mem();
 	}
 got_pg:
-	trace_mark(mm_page_alloc, "order %u pfn %lu", order, page_to_pfn(page));
+	if (page)
+		trace_mark(mm_page_alloc, "order %u pfn %lu", order,
+			   page_to_pfn(page));
 	return page;
 }