From: Vlad Poenaru <vlad.wing@gmail.com>
To: netdev@vger.kernel.org, Jamal Hadi Salim <jhs@mojatatu.com>,
Jiri Pirko <jiri@resnulli.us>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>,
Boqun Feng <boqun@kernel.org>, Waiman Long <longman@redhat.com>,
Bart Van Assche <bvanassche@acm.org>,
Davide Caratti <dcaratti@redhat.com>,
Breno Leitao <leitao@debian.org>,
Nilay Shroff <nilay@linux.ibm.com>,
linux-kernel@vger.kernel.org, Vlad Poenaru <thevlad@meta.com>
Subject: [PATCH net-next 0/2] net/sched: don't wait for RCU when destroying qdisc lockdep keys
Date: Mon, 19 Oct 2026 10:02:23 -0700 [thread overview]
Message-ID: <20261019170225.729789-1-vlad.wing@gmail.com> (raw)
From: Vlad Poenaru <thevlad@meta.com>
On kernels with CONFIG_PROVE_LOCKING, every qdisc except ingress, clsact
and noqueue has a dynamic lockdep key, and destroying the qdisc calls
lockdep_unregister_key(), which waits for an expedited RCU grace period.
Replacing an mq root destroys one qdisc per TX queue under RTNL, so a
single "tc qdisc replace dev eth0 root mq" waits for that many grace
periods. Commit 7a3cedafccf8 ("lockdep: Speed up lockdep_unregister_key()
with expedited RCU synchronization") made each wait shorter as a
temporary workaround until hazard pointers are available.
The wait is redundant for qdiscs: the qdisc is freed with call_rcu()
after its key is unregistered, so the key's memory already outlives an
RCU grace period. Patch 1 revives Bart Van Assche's
lockdep_unregister_key_nosync() [1], with the grace-period requirement
spelled out, and patch 2 uses it for qdisc keys, as Eric suggested [2].
Boqun was concerned that a nosync variant is hard to enforce and review,
since a later refactor could move the free [3]. For qdiscs the RCU-deferred
free is not optional: datapath readers find the qdisc under RCU, so
freeing it synchronously would already be a use-after-free regardless of
lockdep. Patch 2 also documents the requirement at qdisc_lock_uninit().
The hazptr-based replacement for the wait is still under discussion [4];
if it lands, the nosync variant can stay as the no-wait path or be
dropped.
On an x86_64 KASAN + PROVE_LOCKING kernel (64 vCPU KVM guest, 64-queue
netdevsim device, 214K lock chains) this removes 5.3 ms of grace-period
wait from each of the 65 qdisc destroys in "tc qdisc replace dev eth0
root handle 1: mq".
A separate lockdep patch, sent to tip, makes the zap_class() part of
lockdep_unregister_key() cheaper [5]; the two are independent. Nilay
Shroff's pending "lockdep: Fix subclass resource leak in
lockdep_unregister_key()" [6] touches the same function as patch 1;
whichever lands second needs a trivial rebase.
Peter, Boqun, Waiman: if patch 1 looks fine, an Ack for taking it
through net-next with its user would be appreciated.
[1] https://lore.kernel.org/all/20250203175939.3133477-2-bvanassche@acm.org/
[2] https://lore.kernel.org/all/CANn89iLvu_ijSV+FnrZ6qei_Ty2c9V-RjwLMk24+oOS91bNjaQ@mail.gmail.com/
[3] https://lore.kernel.org/all/Z-OPya5HoqbKmMGj@Mac.home/
[4] https://lore.kernel.org/all/20261005171529.1378809-9-kunwu.chan@gmail.com/
[5] https://lore.kernel.org/all/20261019170018.699298-1-vlad.wing@gmail.com/
[6] https://lore.kernel.org/all/20260727182312.3750145-1-nilay@linux.ibm.com/
Bart Van Assche (1):
lockdep: Introduce lockdep_unregister_key_nosync()
Vlad Poenaru (1):
net/sched: Don't wait for RCU when unregistering the qdisc lockdep key
include/linux/lockdep.h | 5 +++++
include/net/pkt_sched.h | 3 ++-
kernel/locking/lockdep.c | 36 +++++++++++++++++++++++++-----------
net/sched/sch_generic.c | 2 +-
4 files changed, 33 insertions(+), 13 deletions(-)
--
2.53.0-Meta
next reply other threads:[~2026-10-19 17:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-19 17:02 Vlad Poenaru [this message]
2026-10-19 17:02 ` [PATCH net-next 1/2] lockdep: Introduce lockdep_unregister_key_nosync() Vlad Poenaru
2026-10-19 17:38 ` Eric Dumazet
2026-10-19 17:02 ` [PATCH net-next 2/2] net/sched: Don't wait for RCU when unregistering the qdisc lockdep key Vlad Poenaru
2026-10-19 17:37 ` Eric Dumazet
2026-10-19 19:20 ` [PATCH net-next 0/2] net/sched: don't wait for RCU when destroying qdisc lockdep keys Boqun Feng
2026-10-20 12:53 ` Vlad Poenaru
2026-10-20 17:15 ` Boqun Feng
2026-10-20 17:26 ` Bart Van Assche
2026-10-20 18:12 ` Boqun Feng
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=20261019170225.729789-1-vlad.wing@gmail.com \
--to=vlad.wing@gmail.com \
--cc=boqun@kernel.org \
--cc=bvanassche@acm.org \
--cc=davem@davemloft.net \
--cc=dcaratti@redhat.com \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=leitao@debian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mingo@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=nilay@linux.ibm.com \
--cc=pabeni@redhat.com \
--cc=peterz@infradead.org \
--cc=thevlad@meta.com \
--cc=will@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.