linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Alex Shi <alex.shi@linux.alibaba.com>
To: Lorenzo Stoakes <lstoakes@gmail.com>,
	Johannes Weiner <hannes@cmpxchg.org>, Hui Su <sh_def@163.com>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Shakeel Butt <shakeelb@google.com>, Roman Gushchin <guro@fb.com>
Cc: syzbot <syzbot+ce635500093181f39c1c@syzkaller.appspotmail.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>,
	Linux-Next Mailing List <linux-next@vger.kernel.org>,
	syzkaller-bugs <syzkaller-bugs@googlegroups.com>
Subject: Re: [PATCH] mm/memcg: warn on missing memcg on mem_cgroup_page_lruvec()
Date: Wed, 25 Nov 2020 20:15:11 +0800	[thread overview]
Message-ID: <0918d6f5-8459-7b5e-82a3-6c9792d17433@linux.alibaba.com> (raw)
In-Reply-To: <20201125112202.387009-1-lstoakes@gmail.com>

Acked-by: Alex Shi <alex.shi@linux.alibaba.com>


在 2020/11/25 下午7:22, Lorenzo Stoakes 写道:
> Move memcg check to mem_cgroup_page_lruvec() as there are callers which
> may invoke this with !memcg in mem_cgroup_lruvec(), whereas they should
> not in mem_cgroup_page_lruvec().
> 
> We expect that we have always charged a page to the memcg before
> mem_cgroup_page_lruvec() is invoked, so add a warning to assert that this
> is the case.
> 
> Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com>
> Reported-by: syzbot+ce635500093181f39c1c@syzkaller.appspotmail.com
> ---
>  include/linux/memcontrol.h | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
> index 87ed56dc75f9..3e6a1df3bdb9 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,7 +644,10 @@ 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)
>  {
> -	return mem_cgroup_lruvec(page_memcg(page), pgdat);
> +	struct mem_cgroup *memcg = page_memcg(page);
> +
> +	VM_WARN_ON_ONCE_PAGE(!memcg, page);
> +	return mem_cgroup_lruvec(memcg, pgdat);
>  }
>  
>  static inline bool lruvec_holds_page_lru_lock(struct page *page,
> 


  reply	other threads:[~2020-11-25 12:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-24  7:54 linux-next boot error: WARNING in prepare_kswapd_sleep syzbot
2020-11-24 17:59 ` Lorenzo Stoakes
2020-11-25  6:24   ` Alex Shi
2020-11-25 11:25     ` Lorenzo Stoakes
2020-11-25 11:22 ` [PATCH] mm/memcg: warn on missing memcg on mem_cgroup_page_lruvec() Lorenzo Stoakes
2020-11-25 12:15   ` Alex Shi [this message]
2020-11-25 22:27     ` Stephen Rothwell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0918d6f5-8459-7b5e-82a3-6c9792d17433@linux.alibaba.com \
    --to=alex.shi@linux.alibaba.com \
    --cc=guro@fb.com \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-next@vger.kernel.org \
    --cc=lstoakes@gmail.com \
    --cc=sfr@canb.auug.org.au \
    --cc=sh_def@163.com \
    --cc=shakeelb@google.com \
    --cc=syzbot+ce635500093181f39c1c@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).