On Tue, 12 Mar 2024 at 23:07, Chandan Babu R <chandanbabu@xxxxxxxxxx> wrote: > > Matthew Wilcox (Oracle) (3): > locking: Add rwsem_assert_held() and rwsem_assert_held_write() I have pulled this, but just wanted to note that this makes me wonder... I think the "add basic minimal asserts even when lockdep is disabled" is fine, and we should have done so long ago. At the same time, historically our "assert()" has had a free "no debugging" version. IOW, it's often very nice to enable asserts for development and testing (but lockdep may be overkill and psosibly even entirely unacceptable if you also want to check lock contention etc). But we've had a lot of cases where we add lockdep annotations as both a documentation aid and a debugging aid, knowing that they go away if you don't enable the debug code. And it looks like there's no way to do that for the rwsem_assert_held*() macros. I looked around, and the same is true of assert_spin_locked(), so this isn't a new issue. But I find it sad, because it does actually generate code, and these asserts tend to be things that people never remove. Linus