On Tue, Jul 15, 2025 at 08:56:21AM +0200, Vlastimil Babka wrote: > > the addresses of the locks are different and they're different > > kmalloc buckets, but lockdep cannot understand this without > > explicit local_lock_lockdep_start(). > > The same thing I'm trying to explain in the commit log. > > Thanks for the explanation and sorry for being so dense. > Maybe lockdep's lock classes can be used here somehow instead of having to > teach lockdep completely new tricks, but I don't know enough about those to > know for sure. I tried that with a separate lock_key for each local_trylock_t and it's sort-of kinda works for 16 cpus, but doesn't scale when number of cpus is large. There is no good way to pick LOCKDEP_BITS. It can be made optional on PREEMP_RT only and used for kmalloc buckets only that kmalloc_nolock() is using, but still feels less clean than local_lock_lockdep_start/end() since it makes lockdep work harder. Better ideas?