WSL2-Linux-Kernel/fs
Michal Hocko 44a70adec9 mm, oom_adj: make sure processes sharing mm have same view of oom_score_adj
oom_score_adj is shared for the thread groups (via struct signal) but this
is not sufficient to cover processes sharing mm (CLONE_VM without
CLONE_SIGHAND) and so we can easily end up in a situation when some
processes update their oom_score_adj and confuse the oom killer.  In the
worst case some of those processes might hide from the oom killer
altogether via OOM_SCORE_ADJ_MIN while others are eligible.  OOM killer
would then pick up those eligible but won't be allowed to kill others
sharing the same mm so the mm wouldn't release the mm and so the memory.

It would be ideal to have the oom_score_adj per mm_struct because that is
the natural entity OOM killer considers.  But this will not work because
some programs are doing

	vfork()
	set_oom_adj()
	exec()

We can achieve the same though.  oom_score_adj write handler can set the
oom_score_adj for all processes sharing the same mm if the task is not in
the middle of vfork.  As a result all the processes will share the same
oom_score_adj.  The current implementation is rather pessimistic and
checks all the existing processes by default if there is more than 1
holder of the mm but we do not have any reliable way to check for external
users yet.

Link: http://lkml.kernel.org/r/1466426628-15074-5-git-send-email-mhocko@kernel.org
Signed-off-by: Michal Hocko <mhocko@suse.com>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Cc: Vladimir Davydov <vdavydov@virtuozzo.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-07-28 16:07:41 -07:00
..
9p
adfs
affs
afs
autofs4
befs
bfs
btrfs Merge branch 'akpm' (patches from Andrew) 2016-07-26 19:55:54 -07:00
cachefiles
ceph
cifs mm, memcg: use consistent gfp flags during readahead 2016-07-26 16:19:19 -07:00
coda
configfs
cramfs
crypto
debugfs
devpts
dlm
ecryptfs
efivarfs
efs
exofs
exportfs
ext2 Merge branch 'akpm' (patches from Andrew) 2016-07-26 19:55:54 -07:00
ext4 Merge branch 'akpm' (patches from Andrew) 2016-07-26 19:55:54 -07:00
f2fs The major change in this version is mitigating cpu overheads on write paths by 2016-07-27 10:36:31 -07:00
fat
freevxfs
fscache
fuse
gfs2 Merge branch 'for-4.8/drivers' of git://git.kernel.dk/linux-block 2016-07-26 15:37:51 -07:00
hfs
hfsplus
hostfs
hpfs
hugetlbfs
isofs
jbd2 The major change this cycle is deleting ext4's copy of the file system 2016-07-26 18:35:55 -07:00
jffs2
jfs
kernfs
lockd
logfs
minix
ncpfs
nfs Merge branch 'for-4.8/core' of git://git.kernel.dk/linux-block 2016-07-26 15:03:07 -07:00
nfs_common
nfsd xfs: update for 4.8-rc1 2016-07-27 09:53:35 -07:00
nilfs2 Merge branch 'for-4.8/core' of git://git.kernel.dk/linux-block 2016-07-26 15:03:07 -07:00
nls
notify
ntfs
ocfs2 Merge branch 'akpm' (patches from Andrew) 2016-07-26 19:55:54 -07:00
omfs
openpromfs
orangefs Merge branch 'akpm' (patches from Andrew) 2016-07-26 19:55:54 -07:00
overlayfs
proc mm, oom_adj: make sure processes sharing mm have same view of oom_score_adj 2016-07-28 16:07:41 -07:00
pstore
qnx4
qnx6
quota
ramfs
reiserfs Merge branch 'for-4.8/drivers' of git://git.kernel.dk/linux-block 2016-07-26 15:37:51 -07:00
romfs
squashfs
sysfs
sysv
tracefs
ubifs
udf Merge branch 'for-4.8/drivers' of git://git.kernel.dk/linux-block 2016-07-26 15:37:51 -07:00
ufs
xfs xfs: update for 4.8-rc1 2016-07-27 09:53:35 -07:00
Kconfig
Kconfig.binfmt
Makefile
aio.c
anon_inodes.c
attr.c
bad_inode.c
binfmt_aout.c
binfmt_elf.c
binfmt_elf_fdpic.c
binfmt_em86.c
binfmt_flat.c
binfmt_misc.c
binfmt_script.c
block_dev.c
buffer.c xfs: update for 4.8-rc1 2016-07-27 09:53:35 -07:00
char_dev.c
compat.c
compat_binfmt_elf.c
compat_ioctl.c
coredump.c
dax.c dax: remote unused fault wrappers 2016-07-26 16:19:19 -07:00
dcache.c
dcookies.c
direct-io.c
drop_caches.c
eventfd.c
eventpoll.c
exec.c
fcntl.c
fhandle.c
file.c
file_table.c
filesystems.c
fs-writeback.c fs/fs-writeback.c: inode writeback list tracking tracepoints 2016-07-26 16:19:19 -07:00
fs_pin.c
fs_struct.c
inode.c fs/fs-writeback.c: add a new writeback list for sync 2016-07-26 16:19:19 -07:00
internal.h xfs: update for 4.8-rc1 2016-07-27 09:53:35 -07:00
ioctl.c
iomap.c
libfs.c
locks.c
mbcache.c
mount.h
mpage.c Merge branch 'akpm' (patches from Andrew) 2016-07-26 19:55:54 -07:00
namei.c
namespace.c
no-block.c
nsfs.c
open.c
pipe.c pipe: account to kmemcg 2016-07-26 16:19:19 -07:00
pnode.c
pnode.h
posix_acl.c
proc_namespace.c
read_write.c
readdir.c
select.c
seq_file.c
signalfd.c
splice.c
stack.c
stat.c
statfs.c
super.c fs/fs-writeback.c: add a new writeback list for sync 2016-07-26 16:19:19 -07:00
sync.c
timerfd.c
userfaultfd.c mm: introduce fault_env 2016-07-26 16:19:19 -07:00
utimes.c
xattr.c