Revision e009d5dc0a94a7133e5f1c083732d760bfd038e6 authored by Michal Hocko on 12 March 2015, 23:25:52 UTC, committed by Linus Torvalds on 13 March 2015, 01:46:07 UTC
Tetsuo Handa has pointed out that __GFP_NOFAIL allocations might fail
after OOM killer is disabled if the allocation is performed by a kernel
thread.  This behavior was introduced from the very beginning by
7f33d49a2ed5 ("mm, PM/Freezer: Disable OOM killer when tasks are frozen").
 This means that the basic contract for the allocation request is broken
and the context requesting such an allocation might blow up unexpectedly.

There are basically two ways forward.

1) move oom_killer_disable after kernel threads are frozen.  This has a
   risk that the OOM victim wouldn't be able to finish because it would
   depend on an already frozen kernel thread.  This would be really tricky
   to debug.

2) do not fail GFP_NOFAIL allocation no matter what and risk a
   potential Freezable kernel threads will loop and fail the suspend.
   Incidental allocations after kernel threads are frozen will at least
   dump a warning - if we are lucky and the serial console is still active
   of course...

This patch implements the later option because it is safer.  We would see
warning rather than allocation failures for the kernel threads which would
blow up otherwise and have a higher chances to identify __GFP_NOFAIL users
from deeper pm code.

Signed-off-by: Michal Hocko <mhocko@suse.cz>
Acked-by: David Rientjes <rientjes@gooogle.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 8792f77
History
File Mode Size
tests
Kconfig -rw-r--r-- 2.9 KB
Makefile -rw-r--r-- 880 bytes
acl.c -rw-r--r-- 3.7 KB
async-thread.c -rw-r--r-- 9.1 KB
async-thread.h -rw-r--r-- 2.8 KB
backref.c -rw-r--r-- 49.9 KB
backref.h -rw-r--r-- 2.7 KB
btrfs_inode.h -rw-r--r-- 8.4 KB
check-integrity.c -rw-r--r-- 98.2 KB
check-integrity.h -rw-r--r-- 1.3 KB
compression.c -rw-r--r-- 28.2 KB
compression.h -rw-r--r-- 2.8 KB
ctree.c -rw-r--r-- 151.6 KB
ctree.h -rw-r--r-- 134.6 KB
delayed-inode.c -rw-r--r-- 51.8 KB
delayed-inode.h -rw-r--r-- 4.8 KB
delayed-ref.c -rw-r--r-- 25.4 KB
delayed-ref.h -rw-r--r-- 7.7 KB
dev-replace.c -rw-r--r-- 29.2 KB
dev-replace.h -rw-r--r-- 1.8 KB
dir-item.c -rw-r--r-- 12.8 KB
disk-io.c -rw-r--r-- 117.0 KB
disk-io.h -rw-r--r-- 5.6 KB
export.c -rw-r--r-- 7.5 KB
export.h -rw-r--r-- 301 bytes
extent-tree.c -rw-r--r-- 261.6 KB
extent_io.c -rw-r--r-- 140.1 KB
extent_io.h -rw-r--r-- 14.2 KB
extent_map.c -rw-r--r-- 11.6 KB
extent_map.h -rw-r--r-- 2.4 KB
file-item.c -rw-r--r-- 25.8 KB
file.c -rw-r--r-- 76.1 KB
free-space-cache.c -rw-r--r-- 87.0 KB
free-space-cache.h -rw-r--r-- 4.6 KB
hash.c -rw-r--r-- 1.0 KB
hash.h -rw-r--r-- 1.2 KB
inode-item.c -rw-r--r-- 11.7 KB
inode-map.c -rw-r--r-- 14.2 KB
inode-map.h -rw-r--r-- 455 bytes
inode.c -rw-r--r-- 254.1 KB
ioctl.c -rw-r--r-- 128.1 KB
locking.c -rw-r--r-- 8.0 KB
locking.h -rw-r--r-- 2.1 KB
lzo.c -rw-r--r-- 10.3 KB
math.h -rw-r--r-- 1.1 KB
ordered-data.c -rw-r--r-- 28.2 KB
ordered-data.h -rw-r--r-- 6.8 KB
orphan.c -rw-r--r-- 1.7 KB
print-tree.c -rw-r--r-- 10.6 KB
print-tree.h -rw-r--r-- 906 bytes
props.c -rw-r--r-- 9.7 KB
props.h -rw-r--r-- 1.3 KB
qgroup.c -rw-r--r-- 70.7 KB
qgroup.h -rw-r--r-- 4.3 KB
raid56.c -rw-r--r-- 64.7 KB
raid56.h -rw-r--r-- 2.1 KB
rcu-string.h -rw-r--r-- 1.5 KB
reada.c -rw-r--r-- 24.5 KB
relocation.c -rw-r--r-- 109.4 KB
root-tree.c -rw-r--r-- 12.6 KB
scrub.c -rw-r--r-- 110.1 KB
send.c -rw-r--r-- 138.8 KB
send.h -rw-r--r-- 2.9 KB
struct-funcs.c -rw-r--r-- 4.5 KB
super.c -rw-r--r-- 56.4 KB
sysfs.c -rw-r--r-- 19.4 KB
sysfs.h -rw-r--r-- 2.6 KB
transaction.c -rw-r--r-- 59.1 KB
transaction.h -rw-r--r-- 6.0 KB
tree-defrag.c -rw-r--r-- 3.3 KB
tree-log.c -rw-r--r-- 123.6 KB
tree-log.h -rw-r--r-- 2.8 KB
ulist.c -rw-r--r-- 6.2 KB
ulist.h -rw-r--r-- 2.0 KB
uuid-tree.c -rw-r--r-- 8.0 KB
volumes.c -rw-r--r-- 172.8 KB
volumes.h -rw-r--r-- 15.5 KB
xattr.c -rw-r--r-- 13.0 KB
xattr.h -rw-r--r-- 1.5 KB
zlib.c -rw-r--r-- 10.5 KB

back to top