diff options
| author | Paolo Abeni <[email protected]> | 2025-02-11 17:17:31 +0000 |
|---|---|---|
| committer | Jakub Kicinski <[email protected]> | 2025-02-13 03:37:19 +0000 |
| commit | f0e70409b7eb0584d451f74db0c72af67b6170b3 (patch) | |
| tree | fd089d9c15dd765c289531c084073eec8a666c0e /fs/file_table.c | |
| parent | Merge branch 'netlink-specs-add-a-spec-for-nl80211-wiphy' (diff) | |
| download | kernel-f0e70409b7eb0584d451f74db0c72af67b6170b3.tar.gz kernel-f0e70409b7eb0584d451f74db0c72af67b6170b3.zip | |
net: avoid unconditionally touching sk_tsflags on RX
After commit 5d4cc87414c5 ("net: reorganize "struct sock" fields"),
the sk_tsflags field shares the same cacheline with sk_forward_alloc.
The UDP protocol does not acquire the sock lock in the RX path;
forward allocations are protected via the receive queue spinlock;
additionally udp_recvmsg() calls sock_recv_cmsgs() unconditionally
touching sk_tsflags on each packet reception.
Due to the above, under high packet rate traffic, when the BH and the
user-space process run on different CPUs, UDP packet reception
experiences a cache miss while accessing sk_tsflags.
The receive path doesn't strictly need to access the problematic field;
change sock_set_timestamping() to maintain the relevant information
in a newly allocated sk_flags bit, so that sock_recv_cmsgs() can
take decisions accessing the latter field only.
With this patch applied, on an AMD epic server with i40e NICs, I
measured a 10% performance improvement for small packets UDP flood
performance tests - possibly a larger delta could be observed with more
recent H/W.
Signed-off-by: Paolo Abeni <[email protected]>
Reviewed-by: Eric Dumazet <[email protected]>
Reviewed-by: Willem de Bruijn <[email protected]>
Reviewed-by: Kuniyuki Iwashima <[email protected]>
Link: https://patch.msgid.link/dbd18c8a1171549f8249ac5a8b30b1b5ec88a425.1739294057.git.pabeni@redhat.com
Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'fs/file_table.c')
0 files changed, 0 insertions, 0 deletions
