alistair23-linux/Documentation/filesystems
David Rientjes 2ff05b2b4e oom: move oom_adj value from task_struct to mm_struct
The per-task oom_adj value is a characteristic of its mm more than the
task itself since it's not possible to oom kill any thread that shares the
mm.  If a task were to be killed while attached to an mm that could not be
freed because another thread were set to OOM_DISABLE, it would have
needlessly been terminated since there is no potential for future memory
freeing.

This patch moves oomkilladj (now more appropriately named oom_adj) from
struct task_struct to struct mm_struct.  This requires task_lock() on a
task to check its oom_adj value to protect against exec, but it's already
necessary to take the lock when dereferencing the mm to find the total VM
size for the badness heuristic.

This fixes a livelock if the oom killer chooses a task and another thread
sharing the same memory has an oom_adj value of OOM_DISABLE.  This occurs
because oom_kill_task() repeatedly returns 1 and refuses to kill the
chosen task while select_bad_process() will repeatedly choose the same
task during the next retry.

Taking task_lock() in select_bad_process() to check for OOM_DISABLE and in
oom_kill_task() to check for threads sharing the same memory will be
removed in the next patch in this series where it will no longer be
necessary.

Writing to /proc/pid/oom_adj for a kthread will now return -EINVAL since
these threads are immune from oom killing already.  They simply report an
oom_adj value of OOM_DISABLE.

Cc: Nick Piggin <npiggin@suse.de>
Cc: Rik van Riel <riel@redhat.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-06-16 19:47:43 -07:00
..
caching trivial: Miscellaneous documentation typo fixes 2009-06-12 18:01:47 +02:00
configfs
pohmelfs Staging: Pohmelfs: Added IO permissions and priorities. 2009-04-17 11:06:30 -07:00
00-INDEX nilfs2: add document 2009-04-07 08:31:12 -07:00
9p.txt
adfs.txt
affs.txt
afs.txt
autofs4-mount-control.txt trivial: Miscellaneous documentation typo fixes 2009-06-12 18:01:47 +02:00
automount-support.txt
befs.txt
bfs.txt
btrfs.txt Btrfs: Add Documentation/filesystem/btrfs.txt, remove old COPYING 2009-01-07 09:54:24 -05:00
cifs.txt
coda.txt
cramfs.txt
debugfs.txt Document the debugfs API 2009-06-06 10:28:14 -06:00
dentry-locking.txt
devpts.txt Document usage of multiple-instances of devpts 2009-01-02 10:19:36 -08:00
directory-locking
dlmfs.txt
dnotify.txt
ecryptfs.txt
exofs.txt exofs: Documentation 2009-03-31 19:44:38 +03:00
Exporting
ext2.txt trivial: fix orphan dates in ext2 documentation 2009-03-23 14:21:26 -07:00
ext3.txt trivial: document ext3 semantics of 'ro' option a bit better 2009-03-30 15:21:56 +02:00
ext4.txt trivial: Miscellaneous documentation typo fixes 2009-06-12 18:01:47 +02:00
fiemap.txt trivial: Miscellaneous documentation typo fixes 2009-06-12 18:01:47 +02:00
files.txt fix f_count description in Documentation/filesystems/files.txt 2008-12-31 18:07:42 -05:00
fuse.txt
gfs2-glocks.txt GFS2: Update docs 2009-05-19 10:23:23 +01:00
gfs2.txt GFS2: Update docs 2009-05-19 10:23:23 +01:00
hfs.txt
hfsplus.txt
hpfs.txt
inotify.txt
isofs.txt
jfs.txt
knfsd-stats.txt Document /proc/fs/nfsd/pool_stats 2009-03-27 19:24:27 -04:00
Locking mm: close page_mkwrite races 2009-05-02 15:36:09 -07:00
locks.txt
mandatory-locking.txt
ncpfs.txt
nfs-rdma.txt trivial: Miscellaneous documentation typo fixes 2009-06-12 18:01:47 +02:00
nfs41-server.txt nfsd41: Documentation/filesystems/nfs41-server.txt 2009-04-03 17:41:24 -07:00
nfsroot.txt
nilfs2.txt nilfs2: modify list of unsupported features in caveats 2009-06-10 23:41:11 +09:00
ntfs.txt
ocfs2.txt ocfs2: add mount option and Kconfig option for acl 2009-01-05 08:36:52 -08:00
omfs.txt
porting
proc.txt oom: move oom_adj value from task_struct to mm_struct 2009-06-16 19:47:43 -07:00
quota.txt
ramfs-rootfs-initramfs.txt
relay.txt
romfs.txt
rpc-cache.txt
seq_file.txt
sharedsubtree.txt
smbfs.txt
spufs.txt
squashfs.txt Squashfs: fix documentation typo, Cramfs filesystem limit is 256 MiB 2009-03-05 00:40:13 +00:00
sysfs-pci.txt trivial: Miscellaneous documentation typo fixes 2009-06-12 18:01:47 +02:00
sysfs.txt PATCH [2/2] Documentation/filesystems/sysfs.txt: fix descriptions of device attributes 2009-02-22 09:28:15 -08:00
sysv-fs.txt
tmpfs.txt hugh: update email address 2009-05-21 13:14:32 -07:00
ubifs.txt UBIFS: remove fast unmounting 2009-01-29 16:34:30 +02:00
udf.txt udf: implement mode and dmode mounting options 2009-04-02 12:29:50 +02:00
ufs.txt
vfat.txt trivial: Miscellaneous documentation typo fixes 2009-06-12 18:01:47 +02:00
vfs.txt Documentation/filesystems: remove out of date reference to BKL being held 2009-04-20 23:01:16 -04:00
xfs.txt
xip.txt