]> git.baikalelectronics.ru Git - kernel.git/commit
mm: get rid of radix tree gfp mask for pagecache_get_page
authorMichal Hocko <mhocko@suse.cz>
Mon, 29 Dec 2014 19:30:35 +0000 (20:30 +0100)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 29 Dec 2014 20:45:45 +0000 (12:45 -0800)
commit568aea93b00fb1d4b10edb71a28c9ddff6ca654a
tree4c92e7d997c86700828c11c1b4b5d247e8b7e9f9
parent0af4fb9a18d9b75e32eaca994d8256a288d43a7f
mm: get rid of radix tree gfp mask for pagecache_get_page

Commit 8b04f2deac87 ("mm: non-atomically mark page accessed during page
cache allocation where possible") has added a separate parameter for
specifying gfp mask for radix tree allocations.

Not only this is less than optimal from the API point of view because it
is error prone, it is also buggy currently because
grab_cache_page_write_begin is using GFP_KERNEL for radix tree and if
fgp_flags doesn't contain FGP_NOFS (mostly controlled by fs by
AOP_FLAG_NOFS flag) but the mapping_gfp_mask has __GFP_FS cleared then
the radix tree allocation wouldn't obey the restriction and might
recurse into filesystem and cause deadlocks.  This is the case for most
filesystems unfortunately because only ext4 and gfs2 are using
AOP_FLAG_NOFS.

Let's simply remove radix_gfp_mask parameter because the allocation
context is same for both page cache and for the radix tree.  Just make
sure that the radix tree gets only the sane subset of the mask (e.g.  do
not pass __GFP_WRITE).

Long term it is more preferable to convert remaining users of
AOP_FLAG_NOFS to use mapping_gfp_mask instead and simplify this
interface even further.

Reported-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Michal Hocko <mhocko@suse.cz>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/pagemap.h
mm/filemap.c