linux-stable/fs/orangefs
Michal Hocko 8a5c743e30 mm, memcg: use consistent gfp flags during readahead
Vladimir has noticed that we might declare memcg oom even during
readahead because read_pages only uses GFP_KERNEL (with mapping_gfp
restriction) while __do_page_cache_readahead uses
page_cache_alloc_readahead which adds __GFP_NORETRY to prevent from
OOMs.  This gfp mask discrepancy is really unfortunate and easily
fixable.  Drop page_cache_alloc_readahead() which only has one user and
outsource the gfp_mask logic into readahead_gfp_mask and propagate this
mask from __do_page_cache_readahead down to read_pages.

This alone would have only very limited impact as most filesystems are
implementing ->readpages and the common implementation mpage_readpages
does GFP_KERNEL (with mapping_gfp restriction) again.  We can tell it to
use readahead_gfp_mask instead as this function is called only during
readahead as well.  The same applies to read_cache_pages.

ext4 has its own ext4_mpage_readpages but the path which has pages !=
NULL can use the same gfp mask.  Btrfs, cifs, f2fs and orangefs are
doing a very similar pattern to mpage_readpages so the same can be
applied to them as well.

[akpm@linux-foundation.org: coding-style fixes]
[mhocko@suse.com: restrict gfp mask in mpage_alloc]
  Link: http://lkml.kernel.org/r/20160610074223.GC32285@dhcp22.suse.cz
Link: http://lkml.kernel.org/r/1465301556-26431-1-git-send-email-mhocko@kernel.org
Signed-off-by: Michal Hocko <mhocko@suse.com>
Cc: Vladimir Davydov <vdavydov@parallels.com>
Cc: Chris Mason <clm@fb.com>
Cc: Steve French <sfrench@samba.org>
Cc: Theodore Ts'o <tytso@mit.edu>
Cc: Jan Kara <jack@suse.cz>
Cc: Mike Marshall <hubcap@omnibond.com>
Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: Changman Lee <cm224.lee@samsung.com>
Cc: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-07-26 16:19:19 -07:00
..
acl.c Orangefs: change pvfs2 filenames to orangefs 2015-12-04 12:56:14 -05:00
dcache.c orangefs: use new getattr for revalidate and remove old getattr 2016-03-23 17:36:15 -04:00
devorangefs-req.c orangefs: fix orangefs_superblock locking 2016-03-26 07:22:00 -04:00
dir.c orangefs: remove unused variable 2016-04-08 15:50:44 -04:00
downcall.h orangefs: use ORANGEFS_NAME_LEN everywhere; remove ORANGEFS_NAME_MAX 2016-02-24 17:07:50 -05:00
file.c orangefs: don't open-code inode_lock/inode_unlock 2016-05-02 19:47:23 -04:00
inode.c mm, memcg: use consistent gfp flags during readahead 2016-07-26 16:19:19 -07:00
Kconfig Orangefs: kernel client part 7 2015-10-03 11:40:00 -04:00
Makefile Orangefs: change pvfs2 filenames to orangefs 2015-12-04 12:56:14 -05:00
namei.c orangefs: Avoid symlink upcall if target is too long. 2016-03-09 13:26:39 -05:00
orangefs-bufmap.c mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros 2016-04-04 10:41:08 -07:00
orangefs-bufmap.h orangefs-bufmap.h: trim unused junk 2016-03-25 22:30:54 -04:00
orangefs-cache.c orangefs: get rid of op refcounts 2016-02-19 13:45:56 -05:00
orangefs-debug.h Orangef: remove overlooked old-style userspace debug parts 2015-12-11 11:00:12 -05:00
orangefs-debugfs.c Orangefs: fix ifnullfree.cocci warnings 2016-04-08 14:08:38 -04:00
orangefs-debugfs.h Orangefs: change pvfs2 filenames to orangefs 2015-12-04 12:56:14 -05:00
orangefs-dev-proto.h orangefs: use ORANGEFS_NAME_LEN everywhere; remove ORANGEFS_NAME_MAX 2016-02-24 17:07:50 -05:00
orangefs-kernel.h orangefs: don't open-code inode_lock/inode_unlock 2016-05-02 19:47:23 -04:00
orangefs-mod.c orangefs: put register_chrdev immediately before register_filesystem 2016-03-17 14:34:10 -04:00
orangefs-sysfs.c Orangefs: fix sloppy cleanups of debugfs and sysfs init failures. 2016-03-14 15:48:28 -04:00
orangefs-sysfs.h Orangefs: change pvfs2 filenames to orangefs 2015-12-04 12:56:14 -05:00
orangefs-utils.c Orangefs: cleanups and a strncpy vulnerability fix. 2016-04-09 10:33:58 -07:00
protocol.h orangefs: Add KERN_<LEVEL> to gossip_<level> macros 2016-04-08 14:10:45 -04:00
super.c orangefs: fix orangefs_superblock locking 2016-03-26 07:22:00 -04:00
symlink.c Orangefs: follow_link -> get_link change 2016-03-14 15:48:28 -04:00
upcall.h orangefs: remove vestigial async io code 2016-02-24 17:07:50 -05:00
waitqueue.c Orangefs: improve gossip statements 2016-03-03 13:46:48 -05:00
xattr.c switch xattr_handler->set() to passing dentry and inode separately 2016-05-27 15:39:43 -04:00