[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250212073955.25603-1-kuniyu@amazon.com>
Date: Wed, 12 Feb 2025 16:39:55 +0900
From: Kuniyuki Iwashima <kuniyu@...zon.com>
To: <pabeni@...hat.com>
CC: <davem@...emloft.net>, <edumazet@...gle.com>, <horms@...nel.org>,
<kuba@...nel.org>, <kuniyu@...zon.com>, <netdev@...r.kernel.org>,
<willemb@...gle.com>
Subject: Re: [PATCH net-next] net: avoid unconditionally touching sk_tsflags on RX
From: Paolo Abeni <pabeni@...hat.com>
Date: Tue, 11 Feb 2025 18:17:31 +0100
> 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 <pabeni@...hat.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@...zon.com>
Powered by blists - more mailing lists