[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <67a979c156cbe_14761294f6@willemb.c.googlers.com.notmuch>
Date: Sun, 09 Feb 2025 23:00:01 -0500
From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
To: Paolo Abeni <pabeni@...hat.com>,
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: Re: [RFC PATCH 0/2] udp: avoid false sharing on sk_tsflags
Paolo Abeni wrote:
> 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.
The code looks solid at a high level to me.
But if the issue can be adddressed by just moving a field, that is
quite appealing. So have no reviewed closely yet.
Question is which field to swap it with. Something like sk_rcvlowat is
not used in UDP. But is clearly not a write_rxtx or write_tx field.
Powered by blists - more mailing lists