diff mbox series

[1/2] mm, oom: Don't ratelimit OOM summary line.

Message ID 1550325895-9291-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp (mailing list archive)
State New, archived
Headers show
Series [1/2] mm, oom: Don't ratelimit OOM summary line. | expand

Commit Message

Tetsuo Handa Feb. 16, 2019, 2:04 p.m. UTC
Since the owner of oom_lock cannot send SIGKILL before dump_header()
completes, we need to ratelimit dump_header() in order not to stall
concurrently allocating threads. As a preparation for more aggressive
ratelimiting, bring the one liner summary out of dump_header().

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: yuzhoujian <yuzhoujian@didichuxing.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: David Rientjes <rientjes@google.com>
Cc: "Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Roman Gushchin <guro@fb.com>
Cc: Yang Shi <yang.s@alibaba-inc.com>
---
 mm/oom_kill.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 3a24848..254c7fb 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -440,7 +440,7 @@  static void dump_oom_summary(struct oom_control *oc, struct task_struct *victim)
 		from_kuid(&init_user_ns, task_uid(victim)));
 }
 
-static void dump_header(struct oom_control *oc, struct task_struct *p)
+static void dump_header(struct oom_control *oc)
 {
 	pr_warn("%s invoked oom-killer: gfp_mask=%#x(%pGg), order=%d, oom_score_adj=%hd\n",
 		current->comm, oc->gfp_mask, &oc->gfp_mask, oc->order,
@@ -458,8 +458,6 @@  static void dump_header(struct oom_control *oc, struct task_struct *p)
 	}
 	if (sysctl_oom_dump_tasks)
 		dump_tasks(oc->memcg, oc->nodemask);
-	if (p)
-		dump_oom_summary(oc, p);
 }
 
 /*
@@ -960,7 +958,8 @@  static void oom_kill_process(struct oom_control *oc, const char *message)
 	task_unlock(victim);
 
 	if (__ratelimit(&oom_rs))
-		dump_header(oc, victim);
+		dump_header(oc);
+	dump_oom_summary(oc, victim);
 
 	/*
 	 * Do we need to kill the entire memory cgroup?
@@ -1002,7 +1001,7 @@  static void check_panic_on_oom(struct oom_control *oc,
 	/* Do not panic for oom kills triggered by sysrq */
 	if (is_sysrq_oom(oc))
 		return;
-	dump_header(oc, NULL);
+	dump_header(oc);
 	panic("Out of memory: %s panic_on_oom is enabled\n",
 		sysctl_panic_on_oom == 2 ? "compulsory" : "system-wide");
 }
@@ -1086,7 +1085,7 @@  bool out_of_memory(struct oom_control *oc)
 	select_bad_process(oc);
 	/* Found nothing?!?! */
 	if (!oc->chosen) {
-		dump_header(oc, NULL);
+		dump_header(oc);
 		pr_warn("Out of memory and no killable processes...\n");
 		/*
 		 * If we got here due to an actual allocation at the