From a422907264503289ae5fe56f30ba470296772c50 Mon Sep 17 00:00:00 2001 From: zhongjiang-ali Date: Wed, 18 Mar 2020 14:48:15 +0800 Subject: [PATCH] alinux: Limit the print message frequency when memcg oom triggers fix #25854413 By above message, we see that a lot of memcg oom is triggered by test cases. And has no eligiable process to be killed in that case. Hence, It will print too much oom message by dump_header, resulting in the interrupt is not responded normally. The patch restrict the print times by ratelimit when memcg oom triggers. And as for system level oom, we do not limit tht case because it will panic later. Reviewed-by: Xunlei Pang Signed-off-by: zhongjiang-ali --- mm/oom_kill.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 0175b943f5e5..de6efa6d5763 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -1145,7 +1145,11 @@ bool out_of_memory(struct oom_control *oc) select_bad_process(oc); /* Found nothing?!?! */ if (!oc->chosen) { - dump_global_header(oc, NULL); + if (is_memcg_oom(oc) && __ratelimit(&oom_memcg_rs)) + dump_memcg_header(oc, NULL); + else if (!is_memcg_oom(oc)) + dump_global_header(oc, NULL); + pr_warn("Out of memory and no killable processes...\n"); /* * If we got here due to an actual allocation at the -- GitLab