linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@kernel.org>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Eric Dumazet <edumazet@google.com>, Yan Zhai <yan@cloudflare.com>,
	netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
	Paolo Abeni <pabeni@redhat.com>, Jiri Pirko <jiri@resnulli.us>,
	Simon Horman <horms@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Lorenzo Bianconi <lorenzo@kernel.org>,
	Coco Li <lixiaoyan@google.com>, Wei Wang <weiwan@google.com>,
	Alexander Duyck <alexanderduyck@fb.com>,
	Hannes Frederic Sowa <hannes@stressinduktion.org>,
	linux-kernel@vger.kernel.org, rcu@vger.kernel.org,
	bpf@vger.kernel.org, kernel-team@cloudflare.com
Subject: Re: [PATCH] net: raise RCU qs after each threaded NAPI poll
Date: Wed, 28 Feb 2024 07:15:42 -0800	[thread overview]
Message-ID: <9a0052f9-b022-42c9-a5da-1d6ca3b00885@paulmck-laptop> (raw)
In-Reply-To: <20240228064343.578a5363@kernel.org>

On Wed, Feb 28, 2024 at 06:43:43AM -0800, Jakub Kicinski wrote:
> On Tue, 27 Feb 2024 20:42:24 -0800 Paul E. McKenney wrote:
> > On Tue, Feb 27, 2024 at 07:10:01PM -0800, Jakub Kicinski wrote:
> > > On Tue, 27 Feb 2024 10:32:22 -0800 Paul E. McKenney wrote:  
> > > > The theory is that PREEMPT_RCU kernels have preemption, and get their
> > > > quiescent states that way.  
> > > 
> > > But that doesn't work well enough?
> > > 
> > > Assuming that's the case why don't we add it with the inverse ifdef
> > > condition next to the cond_resched() which follows a few lines down?
> > > 
> > > 			skb_defer_free_flush(sd);
> > > +
> > > +			if (!IS_ENABLED(CONFIG_PREEMPT_RT))
> > > +				rcu_softirq_qs();
> > > +
> > > 			local_bh_enable();
> > > 
> > > 			if (!repoll)
> > > 				break;
> > > 
> > > 			cond_resched();
> > > 		}
> > > 
> > > We won't repoll majority of the time.  
> > 
> > I am not completely clear on what you are proposing, but one complication
> > is that We need preemption disabled across calls to rcu_softirq_qs()
> > and we cannot have preemption disabled across calls to cond_resched().
> 
> I was thinking of using rcu_all_qs(), like cond_resched() does.
> Not sure how it compares in terms of functionality and cost.

It is probably a bit cheaper, but it does nothing for Tasks RCU.  And that
"_all" in the name is a holdover from when there were separate mechanisms
for bh, sched, and preempt, so maybe we should change that name.

> > Another complication is that although CONFIG_PREEMPT_RT kernels are
> > built with CONFIG_PREEMPT_RCU, the reverse is not always the case.
> > And if we are not repolling, don't we have a high probability of doing
> > a voluntary context when we reach napi_thread_wait() at the beginning
> > of that loop?
> 
> Very much so, which is why adding the cost of rcu_softirq_qs()
> for every NAPI run feels like an overkill.

Would it be better to do the rcu_softirq_qs() only once every 1000 times
or some such?  Or once every HZ jiffies?

Or is there a better way?

							Thanx, Paul

  reply	other threads:[~2024-02-28 15:15 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-27 15:44 [PATCH] net: raise RCU qs after each threaded NAPI poll Yan Zhai
2024-02-27 16:44 ` Eric Dumazet
2024-02-27 18:32   ` Paul E. McKenney
2024-02-27 21:22     ` Yan Zhai
2024-02-27 22:58       ` Paul E. McKenney
2024-02-28  3:10     ` Jakub Kicinski
2024-02-28  4:42       ` Paul E. McKenney
2024-02-28 14:43         ` Jakub Kicinski
2024-02-28 15:15           ` Paul E. McKenney [this message]
2024-02-28 15:35             ` Jakub Kicinski
2024-02-28 15:57               ` Yan Zhai
2024-02-28 11:50     ` Toke Høiland-Jørgensen
2024-02-28 15:10       ` Paul E. McKenney
2024-02-28 15:48         ` Yan Zhai
2024-02-28 17:47           ` Paul E. McKenney
2024-02-28 15:37     ` Joel Fernandes
2024-02-28 16:37       ` Yan Zhai
2024-02-28 17:18         ` Paul E. McKenney
2024-02-28 20:14           ` Joel Fernandes
2024-02-28 21:13             ` Paul E. McKenney
2024-02-28 21:27               ` Joel Fernandes
2024-02-28 21:52                 ` Paul E. McKenney
2024-02-28 22:10                   ` Joel Fernandes
2024-02-28 22:19                     ` Paul E. McKenney
2024-02-28 22:33                       ` Steven Rostedt
2024-02-28 22:48                         ` Alexei Starovoitov
2024-02-28 22:58                           ` Paul E. McKenney
2024-02-29 14:21                             ` Joel Fernandes
2024-02-29 16:57                               ` Paul E. McKenney
2024-02-29 17:41                                 ` Joel Fernandes
2024-02-29 18:29                                   ` Paul E. McKenney
2024-03-02  2:24                                     ` Joel Fernandes
2024-03-03  0:25                                       ` Paul E. McKenney
2024-03-03  1:01                                         ` Joel Fernandes
2024-03-04  9:16                                           ` Joel Fernandes
2024-03-05 17:53                                             ` Paul E. McKenney
2024-03-05 19:57                                               ` Mark Rutland
2024-03-05 21:52                                                 ` Paul E. McKenney
2024-03-06 16:56                                               ` Steven Rostedt
2024-03-07 16:57                                             ` Mark Rutland
2024-03-07 18:34                                               ` Mark Rutland
2024-03-07 18:52                                               ` Steven Rostedt
2024-03-07 18:58                                                 ` Paul E. McKenney
2024-03-04  9:16                                           ` Joel Fernandes
2024-02-28 22:49                         ` Paul E. McKenney
2024-02-27 21:17   ` Yan Zhai
2024-02-28 23:53   ` Yan Zhai

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=9a0052f9-b022-42c9-a5da-1d6ca3b00885@paulmck-laptop \
    --to=paulmck@kernel.org \
    --cc=alexanderduyck@fb.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hannes@stressinduktion.org \
    --cc=horms@kernel.org \
    --cc=jiri@resnulli.us \
    --cc=kernel-team@cloudflare.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lixiaoyan@google.com \
    --cc=lorenzo@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rcu@vger.kernel.org \
    --cc=weiwan@google.com \
    --cc=yan@cloudflare.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).