linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [patch -mm] mm, oom: introduce independent oom killer ratelimit state
@ 2012-02-14  1:07 David Rientjes
  2012-02-14  6:20 ` KOSAKI Motohiro
  2012-02-14  6:50 ` KAMEZAWA Hiroyuki
  0 siblings, 2 replies; 3+ messages in thread
From: David Rientjes @ 2012-02-14  1:07 UTC (permalink / raw)
  To: Andrew Morton; +Cc: KOSAKI Motohiro, KAMEZAWA Hiroyuki, linux-mm

printk_ratelimit() uses the global ratelimit state for all printks.  The
oom killer should not be subjected to this state just because another
subsystem or driver may be flooding the kernel log.

This patch introduces printk ratelimiting specifically for the oom
killer.

Signed-off-by: David Rientjes <rientjes@google.com>
---
 mm/oom_kill.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/mm/oom_kill.c b/mm/oom_kill.c
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -34,6 +34,7 @@
 #include <linux/ptrace.h>
 #include <linux/freezer.h>
 #include <linux/ftrace.h>
+#include <linux/ratelimit.h>
 
 #define CREATE_TRACE_POINTS
 #include <trace/events/oom.h>
@@ -444,6 +445,8 @@ static void oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
 	struct task_struct *t = p;
 	struct mm_struct *mm;
 	unsigned int victim_points = 0;
+	static DEFINE_RATELIMIT_STATE(oom_rs, DEFAULT_RATELIMIT_INTERVAL,
+					      DEFAULT_RATELIMIT_BURST);
 
 	/*
 	 * If the task is already exiting, don't alarm the sysadmin or kill
@@ -454,7 +457,7 @@ static void oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
 		return;
 	}
 
-	if (printk_ratelimit())
+	if (__ratelimit(&oom_rs))
 		dump_header(p, gfp_mask, order, memcg, nodemask);
 
 	task_lock(p);

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [patch -mm] mm, oom: introduce independent oom killer ratelimit state
  2012-02-14  1:07 [patch -mm] mm, oom: introduce independent oom killer ratelimit state David Rientjes
@ 2012-02-14  6:20 ` KOSAKI Motohiro
  2012-02-14  6:50 ` KAMEZAWA Hiroyuki
  1 sibling, 0 replies; 3+ messages in thread
From: KOSAKI Motohiro @ 2012-02-14  6:20 UTC (permalink / raw)
  To: David Rientjes; +Cc: Andrew Morton, KAMEZAWA Hiroyuki, linux-mm

2012/2/13 David Rientjes <rientjes@google.com>:
> printk_ratelimit() uses the global ratelimit state for all printks.  The
> oom killer should not be subjected to this state just because another
> subsystem or driver may be flooding the kernel log.
>
> This patch introduces printk ratelimiting specifically for the oom
> killer.
>
> Signed-off-by: David Rientjes <rientjes@google.com>

Acked-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [patch -mm] mm, oom: introduce independent oom killer ratelimit state
  2012-02-14  1:07 [patch -mm] mm, oom: introduce independent oom killer ratelimit state David Rientjes
  2012-02-14  6:20 ` KOSAKI Motohiro
@ 2012-02-14  6:50 ` KAMEZAWA Hiroyuki
  1 sibling, 0 replies; 3+ messages in thread
From: KAMEZAWA Hiroyuki @ 2012-02-14  6:50 UTC (permalink / raw)
  To: David Rientjes; +Cc: Andrew Morton, KOSAKI Motohiro, linux-mm

On Mon, 13 Feb 2012 17:07:31 -0800 (PST)
David Rientjes <rientjes@google.com> wrote:

> printk_ratelimit() uses the global ratelimit state for all printks.  The
> oom killer should not be subjected to this state just because another
> subsystem or driver may be flooding the kernel log.
> 
> This patch introduces printk ratelimiting specifically for the oom
> killer.
> 
> Signed-off-by: David Rientjes <rientjes@google.com>

Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2012-02-14  6:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-14  1:07 [patch -mm] mm, oom: introduce independent oom killer ratelimit state David Rientjes
2012-02-14  6:20 ` KOSAKI Motohiro
2012-02-14  6:50 ` KAMEZAWA Hiroyuki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox