Re: [syzbot] [mm?] [cgroups?] WARNING in __mod_memcg_lruvec_state

From: Yosry Ahmed
Date: Mon May 06 2024 - 12:13:40 EST


On Mon, May 6, 2024 at 8:59 AM Shakeel Butt <shakeel.butt@xxxxxxxxx> wrote:
>
> On Mon, May 06, 2024 at 02:11:57PM +0000, Yosry Ahmed wrote:
> > On Mon, May 06, 2024 at 06:03:29AM -0700, syzbot wrote:
> > > syzbot has found a reproducer for the following issue on:
> > >
> > > HEAD commit: 2b84edefcad1 Add linux-next specific files for 20240506
> > > git tree: linux-next
> > > console+strace: https://syzkaller.appspot.com/x/log.txt?x=1164931f180000
> > > kernel config: https://syzkaller.appspot.com/x/.config?x=b499929e4aaba1af
> > > dashboard link: https://syzkaller.appspot.com/bug?extid=9319a4268a640e26b72b
> > > compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
> > > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=123d5d1f180000
> > > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16527450980000
> > >
> > > Downloadable assets:
> > > disk image: https://storage.googleapis.com/syzbot-assets/6a22cf95ee14/disk-2b84edef.raw.xz
> > > vmlinux: https://storage.googleapis.com/syzbot-assets/f5c45b515282/vmlinux-2b84edef.xz
> > > kernel image: https://storage.googleapis.com/syzbot-assets/9bf98258a662/bzImage-2b84edef.xz
> > >
> > > IMPORTANT: if you fix the issue, please add the following tag to the commit:
> > > Reported-by: syzbot+9319a4268a640e26b72b@xxxxxxxxxxxxxxxxxxxxxxxxx
> > >
> > > ------------[ cut here ]------------
> > > __mod_memcg_lruvec_state: missing stat item 25
> > > WARNING: CPU: 0 PID: 5091 at mm/memcontrol.c:999 __mod_memcg_lruvec_state+0x18c/0x430 mm/memcontrol.c:999
> >
> > This doesn't seem to be the same issue as the original one syzbot
> > reported. It's the same function but a different warning. I am not sure
> > how to tell syzbot that.
> >
> > Anyway, this warning is the one newly introduced by Shakeel. It is
> > firing because NR_SHMEM_PMDMAPPED and/or NR_FILE_PMDMAPPED are being
> > updated using __lruvec_stat_mod_folio(), which also updates the memcg
> > stats. However, these stats are not exported per-memcg.
> >
> > I think the following should fix it.
> >
>
> Hey Yosry, can you please post your patch with the signoff? The patch
> looks good and you can put my ack on it.

Will do. I noticed we also update these stats from
__folio_remove_rmap(). I will send a patch fixing these as well, so
I'll not include your Ack for that as it will be different.