summaryrefslogtreecommitdiffstats
path: root/mm/oom_kill.c
diff options
context:
space:
mode:
authorDavid Rientjes <rientjes@google.com>2018-04-05 16:25:19 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2018-04-05 21:36:27 -0700
commitd46078b2888947a86b6bb997cd5927e602e8fdc9 (patch)
tree84c5dedfbf534274212214e7f3c31af8a69547e7 /mm/oom_kill.c
parent5ecd9d403ad081ed2de7b118c1e96124d4e0ba6c (diff)
downloadlinux-stable-d46078b2888947a86b6bb997cd5927e602e8fdc9.tar.gz
linux-stable-d46078b2888947a86b6bb997cd5927e602e8fdc9.tar.bz2
linux-stable-d46078b2888947a86b6bb997cd5927e602e8fdc9.zip
mm, oom: remove 3% bonus for CAP_SYS_ADMIN processes
Since the 2.6 kernel, the oom killer has slightly biased away from CAP_SYS_ADMIN processes by discounting some of its memory usage in comparison to other processes. This has always been implicit and nothing exactly relies on the behavior. Gaurav notices that __task_cred() can dereference a potentially freed pointer if the task under consideration is exiting because a reference to the task_struct is not held. Remove the CAP_SYS_ADMIN bias so that all processes are treated equally. If any CAP_SYS_ADMIN process would like to be biased against, it is always allowed to adjust /proc/pid/oom_score_adj. Link: http://lkml.kernel.org/r/alpine.DEB.2.20.1803071548510.6996@chino.kir.corp.google.com Signed-off-by: David Rientjes <rientjes@google.com> Reported-by: Gaurav Kohli <gkohli@codeaurora.org> Acked-by: Michal Hocko <mhocko@suse.com> Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/oom_kill.c')
-rw-r--r--mm/oom_kill.c7
1 files changed, 0 insertions, 7 deletions
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 82a92ad67af3..c4c9ecd17c6e 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -226,13 +226,6 @@ unsigned long oom_badness(struct task_struct *p, struct mem_cgroup *memcg,
mm_pgtables_bytes(p->mm) / PAGE_SIZE;
task_unlock(p);
- /*
- * Root processes get 3% bonus, just like the __vm_enough_memory()
- * implementation used by LSMs.
- */
- if (has_capability_noaudit(p, CAP_SYS_ADMIN))
- points -= (points * 3) / 100;
-
/* Normalize to oom_score_adj units */
adj *= totalpages / 1000;
points += adj;