diff options
author | David Rientjes <rientjes@google.com> | 2012-03-21 19:33:47 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-21 20:54:55 -0400 |
commit | dc3f21eadeea6d9898271ff32d35d5e00c6872ea (patch) | |
tree | be56e2d8b5bf7ce4a140d020b5e248dff6a06795 /mm/oom_kill.c | |
parent | 8447d950e7445cae71ad66d0e33784f8388aaf9d (diff) |
mm, oom: introduce independent oom killer ratelimit state
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>
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/oom_kill.c')
-rw-r--r-- | mm/oom_kill.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 856106036ba2..517299c808cb 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/ptrace.h> | 34 | #include <linux/ptrace.h> |
35 | #include <linux/freezer.h> | 35 | #include <linux/freezer.h> |
36 | #include <linux/ftrace.h> | 36 | #include <linux/ftrace.h> |
37 | #include <linux/ratelimit.h> | ||
37 | 38 | ||
38 | #define CREATE_TRACE_POINTS | 39 | #define CREATE_TRACE_POINTS |
39 | #include <trace/events/oom.h> | 40 | #include <trace/events/oom.h> |
@@ -444,6 +445,8 @@ static void oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order, | |||
444 | struct task_struct *t = p; | 445 | struct task_struct *t = p; |
445 | struct mm_struct *mm; | 446 | struct mm_struct *mm; |
446 | unsigned int victim_points = 0; | 447 | unsigned int victim_points = 0; |
448 | static DEFINE_RATELIMIT_STATE(oom_rs, DEFAULT_RATELIMIT_INTERVAL, | ||
449 | DEFAULT_RATELIMIT_BURST); | ||
447 | 450 | ||
448 | /* | 451 | /* |
449 | * If the task is already exiting, don't alarm the sysadmin or kill | 452 | * 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, | |||
454 | return; | 457 | return; |
455 | } | 458 | } |
456 | 459 | ||
457 | if (printk_ratelimit()) | 460 | if (__ratelimit(&oom_rs)) |
458 | dump_header(p, gfp_mask, order, memcg, nodemask); | 461 | dump_header(p, gfp_mask, order, memcg, nodemask); |
459 | 462 | ||
460 | task_lock(p); | 463 | task_lock(p); |