[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9a0052f9-b022-42c9-a5da-1d6ca3b00885@paulmck-laptop>
Date: Wed, 28 Feb 2024 07:15:42 -0800
From: "Paul E. McKenney" <paulmck@...nel.org>
To: Jakub Kicinski <kuba@...nel.org>
Cc: Eric Dumazet <edumazet@...gle.com>, Yan Zhai <yan@...udflare.com>,
netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>,
Paolo Abeni <pabeni@...hat.com>, Jiri Pirko <jiri@...nulli.us>,
Simon Horman <horms@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Lorenzo Bianconi <lorenzo@...nel.org>,
Coco Li <lixiaoyan@...gle.com>, Wei Wang <weiwan@...gle.com>,
Alexander Duyck <alexanderduyck@...com>,
Hannes Frederic Sowa <hannes@...essinduktion.org>,
linux-kernel@...r.kernel.org, rcu@...r.kernel.org,
bpf@...r.kernel.org, kernel-team@...udflare.com
Subject: Re: [PATCH] net: raise RCU qs after each threaded NAPI poll
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
Powered by blists - more mailing lists