提交 525b0962 编写于 作者: W Weilong Chen 提交者: Yang Yingliang

arm64/ascend: Notifier will return a freed val to indecate print logs

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: NWeilong Chen <chenweilong@huawei.com>
Reviewed-by: NDing Tianhong <dingtianhong@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 db1d159b
...@@ -1062,12 +1062,16 @@ EXPORT_SYMBOL_GPL(register_hisi_oom_notifier); ...@@ -1062,12 +1062,16 @@ EXPORT_SYMBOL_GPL(register_hisi_oom_notifier);
static unsigned long last_jiffies; static unsigned long last_jiffies;
int hisi_oom_notifier_call(unsigned long val, void *v) int hisi_oom_notifier_call(unsigned long val, void *v)
{ {
int ret;
unsigned long freed = 0;
/* when enable oom killer, just return */ /* when enable oom killer, just return */
if (sysctl_enable_oom_killer == 1) if (sysctl_enable_oom_killer == 1)
return 0; return 0;
ret = blocking_notifier_call_chain(&hisi_oom_notify_list, val, &freed);
/* Print time interval to 10 seconds */ /* 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); pr_err("OOM_NOTIFIER: oom type %lu\n", val);
dump_stack(); dump_stack();
show_mem(SHOW_MEM_FILTER_NODES, NULL); show_mem(SHOW_MEM_FILTER_NODES, NULL);
...@@ -1075,7 +1079,7 @@ int hisi_oom_notifier_call(unsigned long val, void *v) ...@@ -1075,7 +1079,7 @@ int hisi_oom_notifier_call(unsigned long val, void *v)
last_jiffies = jiffies; last_jiffies = jiffies;
} }
return blocking_notifier_call_chain(&hisi_oom_notify_list, val, v); return ret;
} }
EXPORT_SYMBOL_GPL(hisi_oom_notifier_call); EXPORT_SYMBOL_GPL(hisi_oom_notifier_call);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册