On 2024-05-28 10:10:50 [+0200], Vlastimil Babka (SUSE) wrote: > > I don't mind sending a patch. I'm just not sure if the lock is the right > > thing to do. However it should ensure that interrupts are disabled on > > !RT for the sake of the counter update (if observed in IRQ context). > > Looks like some places there use VM_WARN_ON_IRQS_ENABLED() that's turned off > for PREEMPT_RT, so maybe that's what should replace the current > lockdep_assert, perhaps together with > lockdep_assert_held(this_cpu_ptr(&memcg_stock.stock_lock)); > > But also __mod_memcg_lruvec_state() already has that VM_WARN_ON. This "VM_WARN_ON_IRQS_ENABLED" is the initial assert for "interrupts must be disabled while change the counter". You want to replace it with lockdep? Part of its requirement was that it yells with lockdep disabled. Currently I am leaning towards removing the lockdep_assert_irqs_disabled() from __mod_objcg_mlstate(). Nothing but the counter need it and they have their own check. So? Sebastian