linux/net/sunrpc/xprtrdma
NeilBrown 8db55a032a SUNRPC: improve 'swap' handling: scheduling and PF_MEMALLOC
rpc tasks can be marked as RPC_TASK_SWAPPER.  This causes GFP_MEMALLOC
to be used for some allocations.  This is needed in some cases, but not
in all where it is currently provided, and in some where it isn't
provided.

Currently *all* tasks associated with a rpc_client on which swap is
enabled get the flag and hence some GFP_MEMALLOC support.

GFP_MEMALLOC is provided for ->buf_alloc() but only swap-writes need it.
However xdr_alloc_bvec does not get GFP_MEMALLOC - though it often does
need it.

xdr_alloc_bvec is called while the XPRT_LOCK is held.  If this blocks,
then it blocks all other queued tasks.  So this allocation needs
GFP_MEMALLOC for *all* requests, not just writes, when the xprt is used
for any swap writes.

Similarly, if the transport is not connected, that will block all
requests including swap writes, so memory allocations should get
GFP_MEMALLOC if swap writes are possible.

So with this patch:
 1/ we ONLY set RPC_TASK_SWAPPER for swap writes.
 2/ __rpc_execute() sets PF_MEMALLOC while handling any task
    with RPC_TASK_SWAPPER set, or when handling any task that
    holds the XPRT_LOCKED lock on an xprt used for swap.
    This removes the need for the RPC_IS_SWAPPER() test
    in ->buf_alloc handlers.
 3/ xprt_prepare_transmit() sets PF_MEMALLOC after locking
    any task to a swapper xprt.  __rpc_execute() will clear it.
 3/ PF_MEMALLOC is set for all the connect workers.

Reviewed-by: Chuck Lever <chuck.lever@oracle.com> (for xprtrdma parts)
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
2022-03-13 12:59:35 -04:00
..
backchannel.c xprtrdma: Remove definitions of RPCDBG_FACILITY 2022-01-14 10:35:08 -05:00
frwr_ops.c SUNRPC/xprtrdma: Convert GFP_NOFS to GFP_KERNEL 2022-02-25 18:50:12 -05:00
Makefile svcrdma: Add a "parsed chunk list" data structure 2020-11-30 13:00:22 -05:00
module.c SUNRPC: xprt_load_transport() needs to support the netid "rdma6" 2020-12-02 14:05:52 -05:00
rpc_rdma.c xprtrdma: Remove definitions of RPCDBG_FACILITY 2022-01-14 10:35:08 -05:00
svc_rdma_backchannel.c svcrdma: Normalize Send page handling 2021-03-22 13:22:13 -04:00
svc_rdma_pcl.c svcrdma: Add a "parsed chunk list" data structure 2020-11-30 13:00:22 -05:00
svc_rdma_recvfrom.c svcrdma: Split the svcrdma_wc_receive() tracepoint 2021-10-04 15:40:15 -04:00
svc_rdma_rw.c svcrdma: Split svcrmda_wc_{read,write} tracepoints 2021-10-04 15:40:15 -04:00
svc_rdma_sendto.c svcrdma: Split the svcrdma_wc_send() tracepoint 2021-10-04 15:40:15 -04:00
svc_rdma_transport.c svcrdma: xpt_bc_xprt is already clear in __svc_rdma_free() 2021-08-19 08:29:32 -04:00
svc_rdma.c svcrdma: Deprecate stat variables that are no longer used 2021-01-25 09:36:28 -05:00
transport.c SUNRPC: improve 'swap' handling: scheduling and PF_MEMALLOC 2022-03-13 12:59:35 -04:00
verbs.c SUNRPC/xprtrdma: Convert GFP_NOFS to GFP_KERNEL 2022-02-25 18:50:12 -05:00
xprt_rdma.h xprtrdma: Remove rpcrdma_ep::re_implicit_roundup 2021-10-20 18:09:54 -04:00