alistair23-linux/fs/nfs
Mel Gorman d0164adc89 mm, page_alloc: distinguish between being unable to sleep, unwilling to sleep and avoiding waking kswapd
__GFP_WAIT has been used to identify atomic context in callers that hold
spinlocks or are in interrupts.  They are expected to be high priority and
have access one of two watermarks lower than "min" which can be referred
to as the "atomic reserve".  __GFP_HIGH users get access to the first
lower watermark and can be called the "high priority reserve".

Over time, callers had a requirement to not block when fallback options
were available.  Some have abused __GFP_WAIT leading to a situation where
an optimisitic allocation with a fallback option can access atomic
reserves.

This patch uses __GFP_ATOMIC to identify callers that are truely atomic,
cannot sleep and have no alternative.  High priority users continue to use
__GFP_HIGH.  __GFP_DIRECT_RECLAIM identifies callers that can sleep and
are willing to enter direct reclaim.  __GFP_KSWAPD_RECLAIM to identify
callers that want to wake kswapd for background reclaim.  __GFP_WAIT is
redefined as a caller that is willing to enter direct reclaim and wake
kswapd for background reclaim.

This patch then converts a number of sites

o __GFP_ATOMIC is used by callers that are high priority and have memory
  pools for those requests. GFP_ATOMIC uses this flag.

o Callers that have a limited mempool to guarantee forward progress clear
  __GFP_DIRECT_RECLAIM but keep __GFP_KSWAPD_RECLAIM. bio allocations fall
  into this category where kswapd will still be woken but atomic reserves
  are not used as there is a one-entry mempool to guarantee progress.

o Callers that are checking if they are non-blocking should use the
  helper gfpflags_allow_blocking() where possible. This is because
  checking for __GFP_WAIT as was done historically now can trigger false
  positives. Some exceptions like dm-crypt.c exist where the code intent
  is clearer if __GFP_DIRECT_RECLAIM is used instead of the helper due to
  flag manipulations.

o Callers that built their own GFP flags instead of starting with GFP_KERNEL
  and friends now also need to specify __GFP_KSWAPD_RECLAIM.

The first key hazard to watch out for is callers that removed __GFP_WAIT
and was depending on access to atomic reserves for inconspicuous reasons.
In some cases it may be appropriate for them to use __GFP_HIGH.

The second key hazard is callers that assembled their own combination of
GFP flags instead of starting with something like GFP_KERNEL.  They may
now wish to specify __GFP_KSWAPD_RECLAIM.  It's almost certainly harmless
if it's missed in most cases as other activity will wake kswapd.

Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Acked-by: Michal Hocko <mhocko@suse.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Christoph Lameter <cl@linux.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Vitaly Wool <vitalywool@gmail.com>
Cc: Rik van Riel <riel@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-11-06 17:50:42 -08:00
..
blocklayout NFS client updates for Linux 4.3 2015-09-07 14:02:24 -07:00
filelayout nfs/filelayout: Fix NULL reference caused by double freeing of fh_array 2015-09-17 18:10:28 -04:00
flexfilelayout NFSv4.1/flexfiles: Clean up ff_layout_write_done_cb/ff_layout_commit_done_cb 2015-09-02 15:24:54 -07:00
objlayout
cache_lib.c
cache_lib.h
callback.c NFS client updates for Linux 4.3 2015-09-07 14:02:24 -07:00
callback.h
callback_proc.c NFSv4: Add a tracepoint for CB_LAYOUTRECALL 2015-08-25 14:40:06 -04:00
callback_xdr.c
client.c NFS: Use RPC functions for matching sockaddrs 2015-08-17 13:29:51 -05:00
delegation.c NFSv4: Recovery of recalled read delegations is broken 2015-09-20 22:34:16 -04:00
delegation.h NFSv4: Recovery of recalled read delegations is broken 2015-09-20 22:34:16 -04:00
dir.c NFS: Rename nfs_readdir_free_pagearray() and nfs_readdir_large_page() 2015-08-17 13:29:31 -05:00
direct.c NFS: Skip checking ds_cinfo.buckets when lseg's commit_through_mds is set 2015-09-22 18:09:14 -04:00
dns_resolve.c
dns_resolve.h
file.c mm, page_alloc: distinguish between being unable to sleep, unwilling to sleep and avoiding waking kswapd 2015-11-06 17:50:42 -08:00
fscache-index.c
fscache.c
fscache.h
getroot.c
inode.c Revert "NFS: Make close(2) asynchronous when closing NFS O_DIRECT files" 2015-09-04 16:54:29 -04:00
internal.h NFSv4: Respect the server imposed limit on how many changes we may cache 2015-09-07 12:36:17 -04:00
iostat.h
Kconfig
Makefile
mount_clnt.c
namespace.c
netns.h
nfs.h
nfs2super.c
nfs2xdr.c
nfs3_fs.h
nfs3acl.c
nfs3client.c
nfs3proc.c
nfs3super.c
nfs3xdr.c xprtrdma: Fix large NFS SYMLINK calls 2015-08-05 16:21:28 -04:00
nfs4_fs.h NFS: Remove nfs41_server_notify_{target|highest}_slotid_update() 2015-08-17 13:32:00 -05:00
nfs4client.c NFS: Use RPC functions for matching sockaddrs 2015-08-17 13:29:51 -05:00
nfs4file.c NFSv4: Respect the server imposed limit on how many changes we may cache 2015-09-07 12:36:17 -04:00
nfs4getroot.c
nfs4idmap.c KEYS: Merge the type-specific data with the payload data 2015-10-21 15:18:36 +01:00
nfs4idmap.h
nfs4namespace.c
nfs4proc.c File locking related changes for v4.4 (pile #1) 2015-11-05 10:31:29 -08:00
nfs4renewd.c
nfs4session.c
nfs4session.h
nfs4state.c NFSv4: Don't try to reclaim unused state owners 2015-10-02 15:43:07 -04:00
nfs4super.c
nfs4sysctl.c
nfs4trace.c
nfs4trace.h NFS: Fix a tracepoint NULL-pointer dereference 2015-10-06 18:56:25 -04:00
nfs4xdr.c NFSv4: Express delegation limit in units of pages 2015-09-07 12:36:13 -04:00
nfs42.h nfs42: remove unused declaration 2015-08-25 20:06:56 -04:00
nfs42proc.c nfs: fix v4.2 SEEK on files over 2 gigs 2015-09-17 15:48:23 -04:00
nfs42xdr.c nfs42: decode_layoutstats does not need res parameter 2015-08-25 20:06:56 -04:00
nfsroot.c
nfstrace.c
nfstrace.h
pagelist.c nfs: fix pg_test page count calculation 2015-09-17 15:48:23 -04:00
pnfs.c NFS41: make close wait for layoutreturn 2015-09-23 08:55:32 -04:00
pnfs.h NFS41: make close wait for layoutreturn 2015-09-23 08:55:32 -04:00
pnfs_dev.c
pnfs_nfs.c NFS41: fix list splice type 2015-08-20 13:43:53 -05:00
proc.c
read.c NFS: Do cleanup before resetting pageio read/write to mds 2015-09-20 13:46:45 -04:00
super.c NFS: Error out when register_shrinker fail in register_nfs_fs 2015-08-12 14:42:23 -04:00
symlink.c
sysctl.c
unlink.c
write.c NFS: Fix a write performance regression 2015-10-02 15:43:07 -04:00