From 75b7f8013b4121bf744908522816ad637ec7ed25 Mon Sep 17 00:00:00 2001 From: Yang Yingliang Date: Fri, 15 Nov 2019 21:45:18 +0800 Subject: [PATCH] Revert "kernel:mm: Support disable oom-killer and report oom events" ascend inclusion category: feature bugzilla: NA CVE: NA ------------ It's specific code for ascend, so remove it. This reverts commit 9901c4bfc156fc8eb812decb1fa58fa5706c7454. Signed-off-by: Yang Yingliang --- include/linux/oom.h | 14 -------------- kernel/sysctl.c | 11 ----------- mm/oom_kill.c | 39 --------------------------------------- mm/util.c | 2 -- 4 files changed, 66 deletions(-) diff --git a/include/linux/oom.h b/include/linux/oom.h index 4e9d3b32e911..69864a547663 100644 --- a/include/linux/oom.h +++ b/include/linux/oom.h @@ -117,18 +117,4 @@ extern struct task_struct *find_lock_task_mm(struct task_struct *p); extern int sysctl_oom_dump_tasks; extern int sysctl_oom_kill_allocating_task; extern int sysctl_panic_on_oom; - -#ifdef CONFIG_ARCH_ASCEND - -extern int sysctl_enable_oom_killer; -extern int register_hisi_oom_notifier(struct notifier_block *nb); -extern int hisi_oom_notifier_call(unsigned long val, void *v); -extern int unregister_hisi_oom_notifier(struct notifier_block *nb); - -#else - -#define sysctl_enable_oom_killer 1 -#define hisi_oom_notifier_call(val, p) ({NOTIFY_DONE; }) -#endif - #endif /* _INCLUDE_LINUX_OOM_H */ diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 39b8c7f41faf..a22bc53edfd2 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -1264,17 +1264,6 @@ static struct ctl_table vm_table[] = { .extra1 = &zero, .extra2 = &two, }, -#ifdef CONFIG_ARCH_ASCEND - { - .procname = "enable_oom_killer", - .data = &sysctl_enable_oom_killer, - .maxlen = sizeof(sysctl_enable_oom_killer), - .mode = 0644, - .proc_handler = proc_dointvec_minmax, - .extra1 = &zero, - .extra2 = &one, - }, -#endif { .procname = "oom_kill_allocating_task", .data = &sysctl_oom_kill_allocating_task, diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 320ed1aca55b..8a4570c53e83 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -1047,40 +1047,6 @@ int unregister_oom_notifier(struct notifier_block *nb) } EXPORT_SYMBOL_GPL(unregister_oom_notifier); -#ifdef CONFIG_ARCH_ASCEND - -int sysctl_enable_oom_killer; -static BLOCKING_NOTIFIER_HEAD(hisi_oom_notify_list); - -int register_hisi_oom_notifier(struct notifier_block *nb) -{ - return blocking_notifier_chain_register(&hisi_oom_notify_list, nb); -} -EXPORT_SYMBOL_GPL(register_hisi_oom_notifier); - -static unsigned long last_jiffies; -int hisi_oom_notifier_call(unsigned long val, void *v) -{ - /* Print time interval to 10 seconds */ - if (time_after(jiffies, last_jiffies + 10 * HZ)) { - pr_warn("HISI_OOM_NOTIFIER: oom type %lu\n", val); - dump_stack(); - show_mem(SHOW_MEM_FILTER_NODES, NULL); - dump_tasks(NULL, 0); - last_jiffies = jiffies; - } - return blocking_notifier_call_chain(&hisi_oom_notify_list, val, v); -} -EXPORT_SYMBOL_GPL(hisi_oom_notifier_call); - -int unregister_hisi_oom_notifier(struct notifier_block *nb) -{ - return blocking_notifier_chain_unregister(&hisi_oom_notify_list, nb); -} -EXPORT_SYMBOL_GPL(unregister_hisi_oom_notifier); - -#endif - /** * out_of_memory - kill the "best" process when we run out of memory * @oc: pointer to struct oom_control @@ -1098,11 +1064,6 @@ bool out_of_memory(struct oom_control *oc) if (oom_killer_disabled) return false; - if (!sysctl_enable_oom_killer) { - hisi_oom_notifier_call(0, NULL); - return false; - } - if (!is_memcg_oom(oc)) { blocking_notifier_call_chain(&oom_notify_list, 0, &freed); if (freed > 0) diff --git a/mm/util.c b/mm/util.c index 4531b792d4da..bc847ae3a626 100644 --- a/mm/util.c +++ b/mm/util.c @@ -17,7 +17,6 @@ #include #include -#include #include "internal.h" @@ -727,7 +726,6 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin) if (percpu_counter_read_positive(&vm_committed_as) < allowed) return 0; error: - hisi_oom_notifier_call(1, NULL); vm_unacct_memory(pages); return -ENOMEM; -- GitLab