mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-19 07:27:50 +00:00
2ff05b2b4e
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> |
||
---|---|---|
.. | ||
caching | ||
configfs | ||
pohmelfs | ||
9p.txt | ||
00-INDEX | ||
adfs.txt | ||
affs.txt | ||
afs.txt | ||
autofs4-mount-control.txt | ||
automount-support.txt | ||
befs.txt | ||
bfs.txt | ||
btrfs.txt | ||
cifs.txt | ||
coda.txt | ||
cramfs.txt | ||
debugfs.txt | ||
dentry-locking.txt | ||
devpts.txt | ||
directory-locking | ||
dlmfs.txt | ||
dnotify.txt | ||
ecryptfs.txt | ||
exofs.txt | ||
Exporting | ||
ext2.txt | ||
ext3.txt | ||
ext4.txt | ||
fiemap.txt | ||
files.txt | ||
fuse.txt | ||
gfs2-glocks.txt | ||
gfs2.txt | ||
hfs.txt | ||
hfsplus.txt | ||
hpfs.txt | ||
inotify.txt | ||
isofs.txt | ||
jfs.txt | ||
knfsd-stats.txt | ||
Locking | ||
locks.txt | ||
mandatory-locking.txt | ||
ncpfs.txt | ||
nfs41-server.txt | ||
nfs-rdma.txt | ||
nfsroot.txt | ||
nilfs2.txt | ||
ntfs.txt | ||
ocfs2.txt | ||
omfs.txt | ||
porting | ||
proc.txt | ||
quota.txt | ||
ramfs-rootfs-initramfs.txt | ||
relay.txt | ||
romfs.txt | ||
rpc-cache.txt | ||
seq_file.txt | ||
sharedsubtree.txt | ||
smbfs.txt | ||
spufs.txt | ||
squashfs.txt | ||
sysfs-pci.txt | ||
sysfs.txt | ||
sysv-fs.txt | ||
tmpfs.txt | ||
ubifs.txt | ||
udf.txt | ||
ufs.txt | ||
vfat.txt | ||
vfs.txt | ||
xfs.txt | ||
xip.txt |