Re: [PATCH v4 02/22] mm/slab: fix false lockdep warning in __kfree_rcu_sheaf()

Harry Yoo
2026-01-24T10:59:24Z

On Fri, Jan 23, 2026 at 01:03:02PM +0100, Sebastian Andrzej Siewior wrote:
> On 2026-01-23 07:52:40 [+0100], Vlastimil Babka wrote:
> > --- a/mm/slub.c
> > +++ b/mm/slub.c
> > @@ -6268,11 +6268,26 @@ static void rcu_free_sheaf(struct rcu_head *head)
> …
> > +static DEFINE_WAIT_OVERRIDE_MAP(kfree_rcu_sheaf_map, LD_WAIT_CONFIG);
> > +
> > bool __kfree_rcu_sheaf(struct kmem_cache *s, void *obj)
> > {
> > struct slub_percpu_sheaves *pcs;
> > struct slab_sheaf *rcu_sheaf;
>
> Would it work to have here something like
> BUG_ON(IS_ENABLED(CONFIG_PREEMPT_RT));
>
> or WARN_ON+return?

I think adding WARN_ON_ONCE() + return would be good enough.
Could you please adjust it, Vlastimil?

> The way the code is now it relies on the check in
> kvfree_call_rcu() and tells lockdep to be quiet. And since it gets
> optimized away…

Yeah, it makes sense to add a warning to avoid future mistake.

> > + lock_map_acquire_try(&kfree_rcu_sheaf_map);
> > +
>
> Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

Thanks a lot!

--
Cheers,
Harry / Hyeonggon