[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <cover.1738940816.git.pabeni@redhat.com>
Date: Fri, 7 Feb 2025 17:23:43 +0100
From: Paolo Abeni <pabeni@...hat.com>
To: netdev@...r.kernel.org
Cc: Willem de Bruijn <willemdebruijn.kernel@...il.com>,
Eric Dumazet <edumazet@...gle.com>,
Kuniyuki Iwashima <kuniyu@...zon.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Simon Horman <horms@...nel.org>,
Neal Cardwell <ncardwell@...gle.com>,
David Ahern <dsahern@...nel.org>
Subject: [RFC PATCH 0/2] udp: avoid false sharing on sk_tsflags
While benchmarking the recently shared page frag revert, I observed a
lot of cache misses in the UDP RX path due to false sharing between the
sk_tsflags and the sk_forward_alloc sk fields.
Here comes a solution attempt for such a problem, inspired by commit
f796feabb9f5 ("udp: add local "peek offset enabled" flag").
The first patch adds a new proto op allowing protocol specific operation
on tsflags updates, and the 2nd one leverages such operation to cache
the problematic field in a cache friendly manner.
The need for a new operation is possibly suboptimal, hence the RFC tag,
but I could not find other good solutions. I considered:
- moving the sk_tsflags just before 'sk_policy', in the 'sock_read_rxtx'
group. It arguably belongs to such group, but the change would create
a couple of holes, increasing the 'struct sock' size and would have
side effects on other protocols
- moving the sk_tsflags just before 'sk_stamp'; similar to the above,
would possibly reduce the side effects, as most of 'struct sock'
layout will be unchanged. Could increase the number of cacheline
accessed in the TX path.
I opted for the present solution as it should minimize the side effects
to other protocols.
Paolo Abeni (2):
sock: introduce set_tsflags operation
udp: avoid false sharing via protocol specific set_tsflags
include/linux/udp.h | 12 ++++++++++++
include/net/sock.h | 15 +++++++++++----
include/net/tcp.h | 1 +
net/core/sock.c | 24 +++++++++---------------
net/ipv4/tcp.c | 16 ++++++++++++++++
net/ipv4/tcp_ipv4.c | 1 +
net/ipv4/udp.c | 3 ++-
net/ipv6/tcp_ipv6.c | 1 +
net/ipv6/udp.c | 3 ++-
9 files changed, 55 insertions(+), 21 deletions(-)
--
2.48.1
Powered by blists - more mailing lists