On Tue, 24 Nov 2020 at 07:54, syzbot
<syzbot+ce635500093181f39...@syzkaller.appspotmail.com> wrote:
> syzbot found the following issue on:
>
> HEAD commit:    d9137320 Add linux-next specific files for 20201124

This appears to be a product of 4b2904f3 ("mm/memcg: add missed
warning in mem_cgroup_lruvec") adding a VM_WARN_ON_ONCE() to
mem_cgroup_lruvec, which when invoked from a function other than
mem_cgroup_page_lruvec() can in fact be called with the condition
false.
If we move the check back into mem_cgroup_page_lruvec() it resolves
the issue. I enclose a simple version of this below, happy to submit
as a proper patch if this is the right approach:


diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 87ed56dc75f9..27cc40a490b2 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -618,7 +618,6 @@ static inline struct lruvec
*mem_cgroup_lruvec(struct mem_cgroup *memcg,
                goto out;
        }

-       VM_WARN_ON_ONCE(!memcg);
        if (!memcg)
                memcg = root_mem_cgroup;

@@ -645,6 +644,7 @@ static inline struct lruvec
*mem_cgroup_lruvec(struct mem_cgroup *memcg,
 static inline struct lruvec *mem_cgroup_page_lruvec(struct page *page,
                                                struct pglist_data *pgdat)
 {
+       VM_WARN_ON_ONCE_PAGE(!page_memcg(page), page);
        return mem_cgroup_lruvec(page_memcg(page), pgdat);
 }

Reply via email to