[PATCH net-next 00/17] rxrpc: Increasing SACK size and moving away from softirq, part 3

From: David Howells
Date: Wed Nov 23 2022 - 05:33:28 EST



This is the third set of patches in the process of moving rxrpc from doing
a lot of its stuff in softirq context to doing it in an I/O thread in
process context and thereby making it easier to support a larger SACK table
(full description in part 1[1]).

[!] Note that these patches are based part 2[2], which is based on a merge
of a fix in net/master with net-next/master. The fix makes a number of
conflicting changes, so it's better if this set is built on top of it.

This set of patches introduces the I/O thread and cuts various bits over to
running there:

(1) Split input.c so that the call packet processing bits are separate
from the received packet distribution bits. Call packet processing
will get bumped over to the call event handler.

(2) Create a per-local endpoint I/O thread. Barring some tiny bits that
still get done in softirq context, all packet reception, processing
and transmission is done in this thread. That will allow a load of
locking to be removed.

(3) Perform packet processing and error processing from the I/O thread.

(4) Provide a mechanism to process call event notifications in the I/O
thread rather than queuing a work item for that call.

(5) Move data and ACK transmission into the I/O thread. ACKs can then be
transmitted at the point they're generated rather than getting
delegated from softirq context to some process context somewhere.

(6) Move call and local processor event handling into the I/O thread.

(7) Move cwnd degradation to after packets have been transmitted so that
they don't shorten the window too quickly.

A bunch of simplifications can then be done:

(1) The input_lock is no longer necessary as exclusion is achieved by
running the code in the I/O thread only.

(2) Don't need to use sk->sk_receive_queue.lock to guard socket state
changes as the socket mutex should suffice.

(3) Don't take spinlocks in RCU callback functions as they get run in
softirq context and thus need _bh annotations.

(4) RCU is then no longer needed for the peer's error_targets list.

(5) Simplify the skbuff handling in the receive path by dropping the ref
in the basic I/O thread loop and getting an extra ref as and when we
need to queue the packet for recvmsg or another context.

Link: https://lore.kernel.org/r/166794587113.2389296.16484814996876530222.stgit@xxxxxxxxxxxxxxxxxxxxxx/ [1]
Link: https://lore.kernel.org/r/166919798040.1256245.11495568684139066955.stgit@xxxxxxxxxxxxxxxxxxxxxx [2]

---
The patches are tagged here:

git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git tags/rxrpc-next-20221121-b

And can be found on this branch:

http://git.kernel.org/cgit/linux/kernel/git/dhowells/linux-fs.git/log/?h=rxrpc-next

David
---
David Howells (17):
rxrpc: Split the receive code
rxrpc: Create a per-local endpoint receive queue and I/O thread
rxrpc: Move packet reception processing into I/O thread
rxrpc: Move error processing into the local endpoint I/O thread
rxrpc: Remove call->input_lock
rxrpc: Don't use sk->sk_receive_queue.lock to guard socket state changes
rxrpc: Don't take spinlocks in the RCU callback functions
rxrpc: Remove the _bh annotation from all the spinlocks
rxrpc: Implement a mechanism to send an event notification to a call
rxrpc: Move DATA transmission into call processor work item
rxrpc: Remove RCU from peer->error_targets list
rxrpc: Make the I/O thread take over the call and local processor work
rxrpc: Trace/count transmission underflows and cwnd resets
rxrpc: Move the cwnd degradation after transmitting packets
rxrpc: Fold __rxrpc_unuse_local() into rxrpc_unuse_local()
rxrpc: Transmit ACKs at the point of generation
rxrpc: Simplify skbuff accounting in receive path


include/trace/events/rxrpc.h | 137 ++++++--
net/rxrpc/Makefile | 1 +
net/rxrpc/af_rxrpc.c | 8 +-
net/rxrpc/ar-internal.h | 84 ++---
net/rxrpc/call_accept.c | 55 +---
net/rxrpc/call_event.c | 255 ++++++++-------
net/rxrpc/call_object.c | 157 +++++----
net/rxrpc/conn_client.c | 8 +-
net/rxrpc/conn_event.c | 76 ++++-
net/rxrpc/conn_object.c | 24 +-
net/rxrpc/conn_service.c | 10 +-
net/rxrpc/input.c | 616 ++++++-----------------------------
net/rxrpc/io_thread.c | 423 ++++++++++++++++++++++++
net/rxrpc/local_event.c | 43 +--
net/rxrpc/local_object.c | 102 ++----
net/rxrpc/output.c | 190 +++++------
net/rxrpc/peer_event.c | 101 +++---
net/rxrpc/peer_object.c | 8 +-
net/rxrpc/proc.c | 31 +-
net/rxrpc/recvmsg.c | 48 ++-
net/rxrpc/sendmsg.c | 99 ++----
net/rxrpc/txbuf.c | 3 +-
22 files changed, 1216 insertions(+), 1263 deletions(-)
create mode 100644 net/rxrpc/io_thread.c