trace: don't call page_to_pfn() if page is NULL
PATCH 1/1 trace: don't call page_to_pfn() if page is NULL
When allocating memory fails, page is NULL. page_to_pfn() will cause the kernel panicked if we don't use sparsemem vmemmap.
--- include/trace/events/kmem.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
include/trace/events/kmem.h +2 -2
@@ -214,7 +214,7 @@ TRACE_EVENT(mm_page_alloc,TP_printk ("page=%p pfn=%lu order=%d migratetype=%d gfp_flags=%s" , __entry->page, -page_to_pfn (__entry->page), + __entry->page ?page_to_pfn (__entry->page) :0 , __entry->order, __entry->migratetype,show_gfp_flags (__entry->gfp_flags))
@@ -240,7 +240,7 @@ DECLARE_EVENT_CLASS(mm_page,TP_printk ("page=%p pfn=%lu order=%u migratetype=%d percpu_refill=%d" , __entry->page, -page_to_pfn (__entry->page), + __entry->page ?page_to_pfn (__entry->page) :0 , __entry->order, __entry->migratetype, __entry->order ==0 )
Signature · 1 line
1.7.1
Quoted 4 lines · Wen Congyang
When allocating memory fails, page is NULL.
page_to_pfn()will cause the kernel panicked if we don't use sparsemem vmemmap.Signed-off-by Wen Congyang <[email protected]>
Nice catch.
I think it's a candidate of stable.
Signature · 2 lines
Kind regards, Minchan Kim
Steven Rostedt
maintainerQuoted 8 lines · Minchan Kim
Quoted 4 lines · Wen Congyang
When allocating memory fails, page is NULL.
page_to_pfn()will cause the kernel panicked if we don't use sparsemem vmemmap.Signed-off-by Wen Congyang <[email protected]>Nice catch.
I think it's a candidate of stable.
Yeah, and it looks like it can go against all stable kernels as it was introduced back in 2.6.32. I'll apply and start testing it.
Thanks,
-- Steve
Quoted 3 lines
Reviewed-by Minchan Kim <[email protected]>
Steven Rostedt
maintainerMel,
As you were the original author of this code, can I get your Acked-by?
Thanks,
-- Steve
Quoted 31 lines · Wen Congyang
When allocating memory fails, page is NULL.
page_to_pfn()will cause the kernel panicked if we don't use sparsemem vmemmap.Signed-off-by Wen Congyang <[email protected]>--- include/trace/events/kmem.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)include/trace/events/kmem.h +2
-2@@ -214,7 +214,7 @@ TRACE_EVENT(mm_page_alloc,TP_printk ("page=%p pfn=%lu order=%d migratetype=%d gfp_flags=%s" , __entry->page, -page_to_pfn (__entry->page), + __entry->page ?page_to_pfn (__entry->page) :0 , __entry->order, __entry->migratetype,show_gfp_flags (__entry->gfp_flags))@@ -240,7 +240,7 @@ DECLARE_EVENT_CLASS(mm_page,TP_printk ("page=%p pfn=%lu order=%u migratetype=%d percpu_refill=%d" , __entry->page, -page_to_pfn (__entry->page), + __entry->page ?page_to_pfn (__entry->page) :0 , __entry->order, __entry->migratetype, __entry->order ==0 )
Mel Gorman
Acked-byQuoted 4 lines · Steven Rostedt
Mel,
As you were the original author of this code, can I get your Acked-by?
Sure. Problem as described is valid and the patch looks ok
Signature · 2 lines
Mel Gorman SUSE Labs
[tip:perf/urgent] tracing: Don't call page_to_pfn() if page is NULL
In reply to Wen CongyangCommit-ID: 85f2a2ef1d0ab99523e0b947a2b723f5650ed6aa Gitweb: http://git.kernel.org/tip/85f2a2ef1d0ab99523e0b947a2b723f5650ed6aa Author: Wen Congyang <[email protected]> AuthorDate: Thu, 20 Sep 2012 14:04:47 +0800 Committer: Steven Rostedt <[email protected]> CommitDate: Thu, 20 Sep 2012 15:51:16 -0400
tracing: Don't call page_to_pfn() if page is NULL
When allocating memory fails, page is NULL. page_to_pfn() will cause the kernel panicked if we don't use sparsemem vmemmap.
--- include/trace/events/kmem.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
include/trace/events/kmem.h +2 -2
@@ -214,7 +214,7 @@ TRACE_EVENT(mm_page_alloc,TP_printk ("page=%p pfn=%lu order=%d migratetype=%d gfp_flags=%s" , __entry->page, -page_to_pfn (__entry->page), + __entry->page ?page_to_pfn (__entry->page) :0 , __entry->order, __entry->migratetype,show_gfp_flags (__entry->gfp_flags))
@@ -240,7 +240,7 @@ DECLARE_EVENT_CLASS(mm_page,TP_printk ("page=%p pfn=%lu order=%u migratetype=%d percpu_refill=%d" , __entry->page, -page_to_pfn (__entry->page), + __entry->page ?page_to_pfn (__entry->page) :0 , __entry->order, __entry->migratetype, __entry->order ==0 )