On Thu, Oct 19, 2023 at 02:38:52PM +0800, Yafang Shao wrote: > > > - BUG_ON(!res_cgroup); > > > + WARN_ON_ONCE(!res_cgroup && lockdep_is_held(&cgroup_mutex)); > > > > This doesn't work. lockdep_is_held() is always true if !PROVE_LOCKING. > > will use mutex_is_locked() instead. But then, someone else can hold the lock and trigger the condition spuriously. The kernel doesn't track who's holding the lock unless lockdep is enabled. Thanks. -- tejun