Skip to content

Commit d46078b

Browse files
rientjestorvalds
authored andcommitted
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/[email protected] Signed-off-by: David Rientjes <[email protected]> Reported-by: Gaurav Kohli <[email protected]> Acked-by: Michal Hocko <[email protected]> Cc: Kirill A. Shutemov <[email protected]> Cc: Andrea Arcangeli <[email protected]> Cc: Tetsuo Handa <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 5ecd9d4 commit d46078b

File tree

1 file changed

+0
-7
lines changed

1 file changed

+0
-7
lines changed

mm/oom_kill.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -226,13 +226,6 @@ unsigned long oom_badness(struct task_struct *p, struct mem_cgroup *memcg,
226226
mm_pgtables_bytes(p->mm) / PAGE_SIZE;
227227
task_unlock(p);
228228

229-
/*
230-
* Root processes get 3% bonus, just like the __vm_enough_memory()
231-
* implementation used by LSMs.
232-
*/
233-
if (has_capability_noaudit(p, CAP_SYS_ADMIN))
234-
points -= (points * 3) / 100;
235-
236229
/* Normalize to oom_score_adj units */
237230
adj *= totalpages / 1000;
238231
points += adj;

0 commit comments

Comments
 (0)