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

Sebastian Andrzej Siewior
2026-01-23T12:03:05Z

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? 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…

> + lock_map_acquire_try(&kfree_rcu_sheaf_map);
> +

Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

Sebastian