Re: [PATCH net-next 2/2] net/sched: Don't wait for RCU when unregistering the qdisc lockdep key

From: Eric Dumazet

Date: Mon Oct 19 2026 - 13:44:06 EST


Le lun. 19 oct. 2026 à 19:02, Vlad Poenaru <vlad.wing@xxxxxxxxx> a écrit :
>
> Since commit af0cb3fa3f9e ("net/sched: fix false lockdep warning on
> qdisc root lock") every qdisc except ingress, clsact and noqueue
> registers a dynamic lockdep key, and destroying it 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, each of which IPIs every CPU that is not idle.
>
> The wait is not needed here: __qdisc_destroy() and qdisc_create() free
> the qdisc with qdisc_free_rcu() after unregistering, which already
> keeps the key's memory valid for a grace period. Use
> lockdep_unregister_key_nosync(), and free with kfree_rcu() in the one
> qdisc_alloc() error path that used kfree().
>
> 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".
>
> Suggested-by: Eric Dumazet <edumazet@xxxxxxxxxx>
> Link: https://lore.kernel.org/all/CANn89iLvu_ijSV+FnrZ6qei_Ty2c9V-RjwLMk24+oOS91bNjaQ@xxxxxxxxxxxxxx/
> Signed-off-by: Vlad Poenaru <vlad.wing@xxxxxxxxx>

Note the cover letter has 'From: Vlad Poenaru <thevlad@xxxxxxxx>', so
this SoB is a bit confusing.

Reviewed-by: Eric Dumazet <edumazet@xxxxxxxxxx>

Thanks.