remarkable-linux/fs/proc
Ying Han 3d5992d2ac oom: add per-mm oom disable count
It's pointless to kill a task if another thread sharing its mm cannot be
killed to allow future memory freeing.  A subsequent patch will prevent
kills in such cases, but first it's necessary to have a way to flag a task
that shares memory with an OOM_DISABLE task that doesn't incur an
additional tasklist scan, which would make select_bad_process() an O(n^2)
function.

This patch adds an atomic counter to struct mm_struct that follows how
many threads attached to it have an oom_score_adj of OOM_SCORE_ADJ_MIN.
They cannot be killed by the kernel, so their memory cannot be freed in
oom conditions.

This only requires task_lock() on the task that we're operating on, it
does not require mm->mmap_sem since task_lock() pins the mm and the
operation is atomic.

[rientjes@google.com: changelog and sys_unshare() code]
[rientjes@google.com: protect oom_disable_count with task_lock in fork]
[rientjes@google.com: use old_mm for oom_disable_count in exec]
Signed-off-by: Ying Han <yinghan@google.com>
Signed-off-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>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-10-26 16:52:05 -07:00
..
array.c CRED: Fix get_task_cred() and task_state() to not resurrect dead credentials 2010-07-29 15:16:17 -07:00
base.c oom: add per-mm oom disable count 2010-10-26 16:52:05 -07:00
cmdline.c
cpuinfo.c
devices.c
generic.c remove inode_setattr 2010-08-09 16:47:37 -04:00
inode.c bkl: Remove locked .ioctl file operation 2010-08-14 00:24:24 +02:00
internal.h proc: rename de_get() to pde_get() and inline it 2009-12-16 07:19:57 -08:00
interrupts.c
Kconfig vmcore: it is not experimental any more 2010-10-26 16:52:05 -07:00
kcore.c kcore: add _text to KCORE_TEXT 2010-05-27 09:12:47 -07:00
kmsg.c procfs: Use generic_file_llseek in /proc/kmsg 2010-04-09 16:35:41 +02:00
loadavg.c sched, timers: cleanup avenrun users 2009-05-15 15:32:45 +02:00
Makefile procfs: simplify conditional processing of fs/proc.o. 2010-08-11 08:59:20 -07:00
meminfo.c hwpoison: fix/proc/meminfo alignment 2009-10-29 07:39:25 -07:00
mmu.c
nommu.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
page.c proc: export uncached bit properly in /proc/kpageflags 2010-09-09 18:57:23 -07:00
proc_devtree.c of: Drop properties with "/" in their name 2010-06-13 18:12:24 -06:00
proc_net.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
proc_sysctl.c llseek: automatically add .llseek fop 2010-10-15 15:53:27 +02:00
proc_tty.c Revert "tty: Add a new file /proc/tty/consoles" 2010-10-23 08:14:12 -07:00
root.c llseek: automatically add .llseek fop 2010-10-15 15:53:27 +02:00
softirqs.c proc: export statistics for softirq to /proc 2009-06-18 13:03:41 -07:00
stat.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
task_mmu.c Merge branch 'llseek' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl 2010-10-22 10:52:56 -07:00
task_nommu.c nommu: add '[stack]' label to /proc/pid/maps output 2010-06-29 15:29:30 -07:00
uptime.c [PATCH] Fix idle time field in /proc/uptime 2009-09-24 10:16:24 +02:00
version.c
vmcore.c /proc/vmcore: fix seeking 2010-09-22 17:22:38 -07:00