[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250306114826.GX3666230@kernel.org>
Date: Thu, 6 Mar 2025 11:48:26 +0000
From: Simon Horman <horms@...nel.org>
To: Breno Leitao <leitao@...ian.org>
Cc: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
kernel-team@...a.com
Subject: Re: [PATCH net-next] netpoll: Optimize skb refilling on critical path
On Tue, Mar 04, 2025 at 07:50:41AM -0800, Breno Leitao wrote:
> netpoll tries to refill the skb queue on every packet send, independently
> if packets are being consumed from the pool or not. This was
> particularly problematic while being called from printk(), where the
> operation would be done while holding the console lock.
>
> Introduce a more intelligent approach to skb queue management. Instead
> of constantly attempting to refill the queue, the system now defers
> refilling to a work queue and only triggers the workqueue when a buffer
> is actually dequeued. This change significantly reduces operations with
> the lock held.
>
> Add a work_struct to the netpoll structure for asynchronous refilling,
> updating find_skb() to schedule refill work only when necessary (skb is
> dequeued).
>
> These changes have demonstrated a 15% reduction in time spent during
> netpoll_send_msg operations, especially when no SKBs are not consumed
> from consumed from pool.
>
> When SKBs are being dequeued, the improvement is even better, around
> 70%, mainly because refilling the SKB pool is now happening outside of
> the critical patch (with console_owner lock held).
>
> Signed-off-by: Breno Leitao <leitao@...ian.org>
> ---
> The above results were obtained using the `function_graph` ftrace
> tracer, with filtering enabled for the netpoll_send_udp() function. The
> test was executed by running the netcons_basic.sh selftest hundreds of
> times.
Reviewed-by: Simon Horman <horms@...nel.org>
Powered by blists - more mailing lists