netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Breno Leitao <leitao@debian.org>
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-team@meta.com
Subject: Re: [PATCH net-next] netpoll: Optimize skb refilling on critical path
Date: Thu, 6 Mar 2025 11:48:26 +0000	[thread overview]
Message-ID: <20250306114826.GX3666230@kernel.org> (raw)
In-Reply-To: <20250304-netpoll_refill_v2-v1-1-06e2916a4642@debian.org>

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@debian.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@kernel.org>


  reply	other threads:[~2025-03-06 11:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-04 15:50 [PATCH net-next] netpoll: Optimize skb refilling on critical path Breno Leitao
2025-03-06 11:48 ` Simon Horman [this message]
2025-03-08  4:00 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250306114826.GX3666230@kernel.org \
    --to=horms@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kernel-team@meta.com \
    --cc=kuba@kernel.org \
    --cc=leitao@debian.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).