android_kernel_xiaomi_sm8350/fs/proc
Mandeep Singh Baines dabb16f639 oom: allow a non-CAP_SYS_RESOURCE proces to oom_score_adj down
We'd like to be able to oom_score_adj a process up/down as it
enters/leaves the foreground.  Currently, it is not possible to oom_adj
down without CAP_SYS_RESOURCE.  This patch allows a task to decrease its
oom_score_adj back to the value that a CAP_SYS_RESOURCE thread set it to
or its inherited value at fork.  Assuming the thread that has forked it
has oom_score_adj of 0, each process could decrease it back from 0 upon
activation unless a CAP_SYS_RESOURCE thread elevated it to something
higher.

Alternative considered:

* a setuid binary
* a daemon with CAP_SYS_RESOURCE

Since you don't wan't all processes to be able to reduce their oom_adj, a
setuid or daemon implementation would be complex.  The alternatives also
have much higher overhead.

This patch updated from original patch based on feedback from David
Rientjes.

Signed-off-by: Mandeep Singh Baines <msb@chromium.org>
Acked-by: David Rientjes <rientjes@google.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Ying Han <yinghan@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-01-13 17:32:35 -08:00
..
array.c proc: use seq_puts()/seq_putc() where possible 2011-01-13 08:03:16 -08:00
base.c oom: allow a non-CAP_SYS_RESOURCE proces to oom_score_adj down 2011-01-13 17:32:35 -08:00
cmdline.c
consoles.c proc: move proc_console.c to fs/proc/consoles.c 2011-01-13 08:03:17 -08:00
cpuinfo.c
devices.c proc: use seq_puts()/seq_putc() where possible 2011-01-13 08:03:16 -08:00
generic.c proc: less LOCK/UNLOCK in remove_proc_entry() 2011-01-13 08:03:17 -08:00
inode.c proc: ->low_ino cleanup 2011-01-13 08:03:16 -08:00
internal.h proc: ->low_ino cleanup 2011-01-13 08:03:16 -08:00
interrupts.c
Kconfig vmcore: it is not experimental any more 2010-10-26 16:52:05 -07:00
kcore.c /proc/kcore: fix seeking 2011-01-13 08:03:17 -08:00
kmsg.c
loadavg.c
Makefile proc: move proc_console.c to fs/proc/consoles.c 2011-01-13 08:03:17 -08:00
meminfo.c
mmu.c
nommu.c
page.c kpagecount: add slab page checking because _mapcount is in a union 2011-01-13 08:03:17 -08:00
proc_devtree.c
proc_net.c
proc_sysctl.c fs: provide rcu-walk aware permission i_ops 2011-01-07 17:50:29 +11:00
proc_tty.c proc: use seq_puts()/seq_putc() where possible 2011-01-13 08:03:16 -08:00
root.c switch procfs to ->mount() 2010-10-29 04:17:01 -04:00
softirqs.c proc: use seq_puts()/seq_putc() where possible 2011-01-13 08:03:16 -08:00
stat.c proc: use seq_puts()/seq_putc() where possible 2011-01-13 08:03:16 -08:00
task_mmu.c mm: smaps: export mlock information 2011-01-13 17:32:33 -08:00
task_nommu.c proc: use unsigned long inside /proc/*/statm 2011-01-13 08:03:16 -08:00
uptime.c
version.c
vmcore.c ARM: 6485/5: proc/vmcore - allow archs to override vmcore_elf_check_arch() 2010-11-30 13:39:55 +00:00