[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aHB3lh4zkh8g5H1T@Mac.home>
Date: Thu, 10 Jul 2025 19:31:50 -0700
From: Boqun Feng <boqun.feng@...il.com>
To: Breno Leitao <leitao@...ian.org>
Cc: linux-kernel@...r.kernel.org, rcu@...r.kernel.org, lkmm@...ts.linux.dev,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...nel.org>, Will Deacon <will@...nel.org>,
Waiman Long <longman@...hat.com>,
Davidlohr Bueso <dave@...olabs.net>,
"Paul E. McKenney" <paulmck@...nel.org>,
Josh Triplett <josh@...htriplett.org>,
Frederic Weisbecker <frederic@...nel.org>,
Neeraj Upadhyay <neeraj.upadhyay@...nel.org>,
Joel Fernandes <joelagnelf@...dia.com>,
Uladzislau Rezki <urezki@...il.com>,
Steven Rostedt <rostedt@...dmis.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Lai Jiangshan <jiangshanlai@...il.com>,
Zqiang <qiang.zhang@...ux.dev>, aeh@...a.com,
netdev@...r.kernel.org, edumazet@...gle.com, jhs@...atatu.com,
kernel-team@...a.com, Erik Lundgren <elundgren@...a.com>
Subject: Re: [PATCH 8/8] locking/lockdep: Use shazptr to protect the key
hashlist
On Thu, Jul 10, 2025 at 07:06:09AM -0700, Breno Leitao wrote:
> Hello Boqun,
>
> On Tue, Jun 24, 2025 at 08:11:01PM -0700, Boqun Feng wrote:
> > Erik Lundgren and Breno Leitao reported [1] a case where
> > lockdep_unregister_key() can be called from time critical code pathes
> > where rntl_lock() may be held. And the synchronize_rcu() in it can slow
> > down operations such as using tc to replace a qdisc in a network device.
> >
> > In fact the synchronize_rcu() in lockdep_unregister_key() is to wait for
> > all is_dynamic_key() callers to finish so that removing a key from the
> > key hashlist, and we can use shazptr to protect the hashlist as well.
> >
> > Compared to the proposed solution which replaces synchronize_rcu() with
> > synchronize_rcu_expedited(), using shazptr here can achieve the
> > same/better synchronization time without the need to send IPI. Hence use
> > shazptr here.
> >
> > Reported-by: Erik Lundgren <elundgren@...a.com>
> > Reported-by: Breno Leitao <leitao@...ian.org>
> > Link: https://lore.kernel.org/all/20250321-lockdep-v1-1-78b732d195fb@debian.org/ [1]
> > Signed-off-by: Boqun Feng <boqun.feng@...il.com>
>
> First of all, thanks for working to fix the origianl issue. I've been
> able to test this in my host, and the gain is impressive.
>
> Before:
>
> # time /usr/sbin/tc qdisc replace dev eth0 root handle 0x1234: mq
> real 0m13.195s
> user 0m0.001s
> sys 0m2.746s
>
> With your patch:
>
> # time /usr/sbin/tc qdisc replace dev eth0 root handle 0x1234: mq
> real 0m0.135s
> user 0m0.002s
> sys 0m0.116s
>
> # time /usr/sbin/tc qdisc replace dev eth0 root handle 0x1: mq
> real 0m0.127s
> user 0m0.001s
> sys 0m0.112s
>
> Please add the following to the series:
>
> Tested-by: Breno Leitao <leitao@...ian.org>
Thanks! Will apply ;-)
Regards,
Boqun
Powered by blists - more mailing lists