
From: Weilong Chen <chenweilong@huawei.com> ascend inclusion category: feature bugzilla: NA CVE: NA ------------------------------------------------- When there's not enough memory, a log of oom messages will be dump. This patch is to reduce messages by using an indecate val passed to the notifier. Signed-off-by: Weilong Chen <chenweilong@huawei.com> Reviewed-by: Ding Tianhong <dingtianhong@huawei.com> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> --- mm/oom_kill.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mm/oom_kill.c b/mm/oom_kill.c index c08041ecd286..46cd317e6743 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -1062,12 +1062,16 @@ EXPORT_SYMBOL_GPL(register_hisi_oom_notifier); static unsigned long last_jiffies; int hisi_oom_notifier_call(unsigned long val, void *v) { + int ret; + unsigned long freed = 0; + /* when enable oom killer, just return */ if (sysctl_enable_oom_killer == 1) return 0; + ret = blocking_notifier_call_chain(&hisi_oom_notify_list, val, &freed); /* Print time interval to 10 seconds */ - if (time_after(jiffies, last_jiffies + 10 * HZ)) { + if (time_after(jiffies, last_jiffies + 10 * HZ) && freed == 0) { pr_err("OOM_NOTIFIER: oom type %lu\n", val); dump_stack(); show_mem(SHOW_MEM_FILTER_NODES, NULL); @@ -1075,7 +1079,7 @@ int hisi_oom_notifier_call(unsigned long val, void *v) last_jiffies = jiffies; } - return blocking_notifier_call_chain(&hisi_oom_notify_list, val, v); + return ret; } EXPORT_SYMBOL_GPL(hisi_oom_notifier_call); -- 2.25.1