linux/fs/nfsd
NeilBrown a37b0715dd mm/writeback: replace PF_LESS_THROTTLE with PF_LOCAL_THROTTLE
PF_LESS_THROTTLE exists for loop-back nfsd (and a similar need in the
loop block driver and callers of prctl(PR_SET_IO_FLUSHER)), where a
daemon needs to write to one bdi (the final bdi) in order to free up
writes queued to another bdi (the client bdi).

The daemon sets PF_LESS_THROTTLE and gets a larger allowance of dirty
pages, so that it can still dirty pages after other processses have been
throttled.  The purpose of this is to avoid deadlock that happen when
the PF_LESS_THROTTLE process must write for any dirty pages to be freed,
but it is being thottled and cannot write.

This approach was designed when all threads were blocked equally,
independently on which device they were writing to, or how fast it was.
Since that time the writeback algorithm has changed substantially with
different threads getting different allowances based on non-trivial
heuristics.  This means the simple "add 25%" heuristic is no longer
reliable.

The important issue is not that the daemon needs a *larger* dirty page
allowance, but that it needs a *private* dirty page allowance, so that
dirty pages for the "client" bdi that it is helping to clear (the bdi
for an NFS filesystem or loop block device etc) do not affect the
throttling of the daemon writing to the "final" bdi.

This patch changes the heuristic so that the task is not throttled when
the bdi it is writing to has a dirty page count below below (or equal
to) the free-run threshold for that bdi.  This ensures it will always be
able to have some pages in flight, and so will not deadlock.

In a steady-state, it is expected that PF_LOCAL_THROTTLE tasks might
still be throttled by global threshold, but that is acceptable as it is
only the deadlock state that is interesting for this flag.

This approach of "only throttle when target bdi is busy" is consistent
with the other use of PF_LESS_THROTTLE in current_may_throttle(), were
it causes attention to be focussed only on the target bdi.

So this patch
 - renames PF_LESS_THROTTLE to PF_LOCAL_THROTTLE,
 - removes the 25% bonus that that flag gives, and
 - If PF_LOCAL_THROTTLE is set, don't delay at all unless the
   global and the local free-run thresholds are exceeded.

Note that previously realtime threads were treated the same as
PF_LESS_THROTTLE threads.  This patch does *not* change the behvaiour
for real-time threads, so it is now different from the behaviour of nfsd
and loop tasks.  I don't know what is wanted for realtime.

[akpm@linux-foundation.org: coding style fixes]
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Acked-by: Chuck Lever <chuck.lever@oracle.com>	[nfsd]
Cc: Christoph Hellwig <hch@lst.de>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Trond Myklebust <trond.myklebust@hammerspace.com>
Link: http://lkml.kernel.org/r/87ftbf7gs3.fsf@notabene.neil.brown.name
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-06-02 10:59:08 -07:00
..
acl.h
auth.c
auth.h
blocklayout.c
blocklayoutxdr.c
blocklayoutxdr.h
cache.h
current_stateid.h
export.c nfsd: export upcalls must not return ESTALE when mountd is down 2020-03-16 12:04:33 -04:00
export.h
fault_inject.c
filecache.c fs: nfsd: fileache.c: Use built-in RCU list checking 2020-03-16 12:04:31 -04:00
filecache.h nfsd: convert file cache to use over/underflow safe refcount 2020-02-06 11:22:55 -05:00
flexfilelayout.c
flexfilelayoutxdr.c
flexfilelayoutxdr.h
idmap.h
Kconfig NFSD: Fix NFS server build errors 2020-03-16 12:04:34 -04:00
lockd.c
Makefile
netns.h nfsd: set the server_scope during service startup 2020-03-16 12:04:30 -04:00
nfs2acl.c
nfs3acl.c
nfs3proc.c nfsd: Ensure sampling of the write verifier is atomic with the write 2020-01-22 16:25:41 -05:00
nfs3xdr.c nfsd: Ensure sampling of the write verifier is atomic with the write 2020-01-22 16:25:41 -05:00
nfs4acl.c
nfs4callback.c SUNRPC: Fix backchannel RPC soft lockups 2020-04-17 12:40:31 -04:00
nfs4idmap.c nfsd: export upcalls must not return ESTALE when mountd is down 2020-03-16 12:04:33 -04:00
nfs4layouts.c nfsd: fix delay timer on 32-bit architectures 2019-12-19 17:46:08 -05:00
nfs4proc.c nfsd4: fix double free in nfsd4_do_async_copy() 2020-02-06 11:22:55 -05:00
nfs4recover.c nfsd: use crypto_shash_tfm_digest() 2020-05-08 15:32:15 +10:00
nfs4state.c nfsd: memory corruption in nfsd4_lock() 2020-04-13 10:28:21 -04:00
nfs4xdr.c NFSD: Clean up nfsd4_encode_readv 2020-03-16 12:04:31 -04:00
nfscache.c
nfsctl.c nfsd: fsnotify on rmdir under nfsd/clients/ 2020-03-19 11:33:42 -04:00
nfsd.h nfsd: remove nfs4_reset_lease() declarations 2019-12-19 22:07:17 -05:00
nfsfh.c nfsd: Add tracing to nfsd_set_fh_dentry() 2020-03-16 12:04:33 -04:00
nfsfh.h nfsd: handle nfs3 timestamps as unsigned 2019-12-19 17:46:08 -05:00
nfsproc.c nfsd: Ensure sampling of the write verifier is atomic with the write 2020-01-22 16:25:41 -05:00
nfssvc.c nfsd: set the server_scope during service startup 2020-03-16 12:04:30 -04:00
nfsxdr.c
pnfs.h
state.h nfsd: use boottime for lease expiry calculation 2019-12-19 22:07:17 -05:00
stats.c proc: convert everything to "struct proc_ops" 2020-02-04 03:05:26 +00:00
stats.h
trace.c
trace.h nfsd: Add tracepoints for update of the expkey and export cache entries 2020-03-16 12:04:33 -04:00
vfs.c mm/writeback: replace PF_LESS_THROTTLE with PF_LOCAL_THROTTLE 2020-06-02 10:59:08 -07:00
vfs.h nfsd: Ensure sampling of the write verifier is atomic with the write 2020-01-22 16:25:41 -05:00
xdr3.h nfsd: Ensure sampling of the write verifier is atomic with the write 2020-01-22 16:25:41 -05:00
xdr4.h NFSD add nfs4 inter ssc to nfsd4_copy 2019-12-09 11:44:07 -05:00
xdr4cb.h
xdr.h