Re: [PATCH] mm/memcontrol: restore irq wrapper for lruvec_stat_mod_folio()

Vlastimil Babka (SUSE)
2026-04-14T07:56:45Z

On 4/13/26 18:44, Shakeel Butt wrote:
> On Mon, Apr 13, 2026 at 02:48:33PM +0800, Cao Ruichuang wrote:
>> Commit c1bd09994c4d ("memcg: remove __lruvec_stat_mod_folio") removed
>> the local_irq_save/restore wrapper around lruvec_stat_mod_folio(), based
>> on the assumption that the underlying stat update path was already
>> IRQ-safe.
>
> Why is that an assumption? Please explain how lruvec_stat_mod_folio() is not
> safe against IRQs?
>
>>
>> That assumption is too broad for lruvec_stat_mod_folio() callers.
>> This helper is not just a thin stat primitive. It also resolves
>> folio -> memcg -> lruvec under a helper-managed RCU read-side section.
>>
>> syzbot now reports a PREEMPT_RT warning from:
>
> The syzbot link you have provided has the kernel config without PREEMPT_RT?
> Where does this claim come from?
>
>>
>> __filemap_add_folio()
>> -> lruvec_stat_mod_folio()
>> -> __rcu_read_unlock()
>>
>> ending in bad unlock balance / negative RCU nesting.
>
> If there is bad unlock balance, how is disabling/enabling IRQs would solve that
> issue?

This is obviously a product of LLM producing a patch from the syzbot report.
I suggest we ignore everything from this author.