Re: [PATCH v2] memcg: simple cleanup of stats update functions
From: Vlastimil Babka (SUSE)
Date: Tue May 28 2024 - 08:18:11 EST
On 5/28/24 12:19 PM, Sebastian Andrzej Siewior wrote:
> 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.
No I meant the other way around, that we'de use VM_WARN_ON_IRQS_ENABLED
instead of the current lockdep_assert() that doesn't work on RT.
> 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?
Yeah that might be sufficient.
> Sebastian