All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] trace: don't call page_to_pfn() if page is NULL
@ 2012-09-20  6:04 Wen Congyang
  2012-09-20  6:28 ` Minchan Kim
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Wen Congyang @ 2012-09-20  6:04 UTC (permalink / raw)
  To: Steven Rostedt, Frederic Weisbecker, Ingo Molnar, Minchan Kim,
	Andrew Morton, khlebnikov, linux-kernel@vger.kernel.org

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 <wency@cn.fujitsu.com>

---
 include/trace/events/kmem.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h
index 5f889f1..08fa272 100644
--- a/include/trace/events/kmem.h
+++ b/include/trace/events/kmem.h
@@ -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)
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] trace: don't call page_to_pfn() if page is NULL
  2012-09-20  6:04 [PATCH] trace: don't call page_to_pfn() if page is NULL Wen Congyang
@ 2012-09-20  6:28 ` Minchan Kim
  2012-09-20 13:41   ` Steven Rostedt
  2012-09-20 13:48 ` Steven Rostedt
  2012-09-21 12:37 ` [tip:perf/urgent] tracing: Don't " tip-bot for Wen Congyang
  2 siblings, 1 reply; 6+ messages in thread
From: Minchan Kim @ 2012-09-20  6:28 UTC (permalink / raw)
  To: Wen Congyang
  Cc: Steven Rostedt, Frederic Weisbecker, Ingo Molnar, Andrew Morton,
	khlebnikov, linux-kernel@vger.kernel.org

On Thu, Sep 20, 2012 at 02:04:47PM +0800, Wen Congyang wrote:
> 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 <wency@cn.fujitsu.com>

Nice catch.
I think it's a candidate of stable.

Reviewed-by: Minchan Kim <minchan@kernel.org>

-- 
Kind regards,
Minchan Kim

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] trace: don't call page_to_pfn() if page is NULL
  2012-09-20  6:28 ` Minchan Kim
@ 2012-09-20 13:41   ` Steven Rostedt
  0 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2012-09-20 13:41 UTC (permalink / raw)
  To: Minchan Kim
  Cc: Wen Congyang, Frederic Weisbecker, Ingo Molnar, Andrew Morton,
	khlebnikov, linux-kernel@vger.kernel.org, stable

On Thu, 2012-09-20 at 15:28 +0900, Minchan Kim wrote:
> On Thu, Sep 20, 2012 at 02:04:47PM +0800, Wen Congyang wrote:
> > 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 <wency@cn.fujitsu.com>
> 
> 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

> 
> Reviewed-by: Minchan Kim <minchan@kernel.org>
> 



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] trace: don't call page_to_pfn() if page is NULL
  2012-09-20  6:04 [PATCH] trace: don't call page_to_pfn() if page is NULL Wen Congyang
  2012-09-20  6:28 ` Minchan Kim
@ 2012-09-20 13:48 ` Steven Rostedt
  2012-09-20 14:24   ` Mel Gorman
  2012-09-21 12:37 ` [tip:perf/urgent] tracing: Don't " tip-bot for Wen Congyang
  2 siblings, 1 reply; 6+ messages in thread
From: Steven Rostedt @ 2012-09-20 13:48 UTC (permalink / raw)
  To: Wen Congyang, Mel Gorman
  Cc: Frederic Weisbecker, Ingo Molnar, Minchan Kim, Andrew Morton,
	khlebnikov, linux-kernel@vger.kernel.org

Mel,

As you were the original author of this code, can I get your Acked-by?

Thanks,

-- Steve


On Thu, 2012-09-20 at 14:04 +0800, Wen Congyang wrote:
> 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 <wency@cn.fujitsu.com>
> 
> ---
>  include/trace/events/kmem.h |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h
> index 5f889f1..08fa272 100644
> --- a/include/trace/events/kmem.h
> +++ b/include/trace/events/kmem.h
> @@ -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)



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] trace: don't call page_to_pfn() if page is NULL
  2012-09-20 13:48 ` Steven Rostedt
@ 2012-09-20 14:24   ` Mel Gorman
  0 siblings, 0 replies; 6+ messages in thread
From: Mel Gorman @ 2012-09-20 14:24 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Wen Congyang, Frederic Weisbecker, Ingo Molnar, Minchan Kim,
	Andrew Morton, khlebnikov, linux-kernel@vger.kernel.org

On Thu, Sep 20, 2012 at 09:48:24AM -0400, Steven Rostedt wrote:
> 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

Acked-by: Mel Gorman <mel@csn.ul.ie>

-- 
Mel Gorman
SUSE Labs

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [tip:perf/urgent] tracing: Don't call page_to_pfn() if page is NULL
  2012-09-20  6:04 [PATCH] trace: don't call page_to_pfn() if page is NULL Wen Congyang
  2012-09-20  6:28 ` Minchan Kim
  2012-09-20 13:48 ` Steven Rostedt
@ 2012-09-21 12:37 ` tip-bot for Wen Congyang
  2 siblings, 0 replies; 6+ messages in thread
From: tip-bot for Wen Congyang @ 2012-09-21 12:37 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mingo, linux-kernel, hpa, mingo, minchan, mel, stable, wency,
	fweisbec, rostedt, akpm, tglx

Commit-ID:  85f2a2ef1d0ab99523e0b947a2b723f5650ed6aa
Gitweb:     http://git.kernel.org/tip/85f2a2ef1d0ab99523e0b947a2b723f5650ed6aa
Author:     Wen Congyang <wency@cn.fujitsu.com>
AuthorDate: Thu, 20 Sep 2012 14:04:47 +0800
Committer:  Steven Rostedt <rostedt@goodmis.org>
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.

Link: http://lkml.kernel.org/r/505AB1FF.8020104@cn.fujitsu.com

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: stable <stable@vger.kernel.org>
Acked-by: Mel Gorman <mel@csn.ul.ie>
Reviewed-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 include/trace/events/kmem.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h
index 5f889f1..08fa272 100644
--- a/include/trace/events/kmem.h
+++ b/include/trace/events/kmem.h
@@ -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)

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-09-21 12:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-20  6:04 [PATCH] trace: don't call page_to_pfn() if page is NULL Wen Congyang
2012-09-20  6:28 ` Minchan Kim
2012-09-20 13:41   ` Steven Rostedt
2012-09-20 13:48 ` Steven Rostedt
2012-09-20 14:24   ` Mel Gorman
2012-09-21 12:37 ` [tip:perf/urgent] tracing: Don't " tip-bot for Wen Congyang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.