From: Yosry Ahmed <yosryahmed@google.com>
To: Michal Hocko <mhocko@suse.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Hugh Dickins <hughd@google.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Roman Gushchin <roman.gushchin@linux.dev>,
Shakeel Butt <shakeelb@google.com>,
Muchun Song <muchun.song@linux.dev>,
Naoya Horiguchi <naoya.horiguchi@nec.com>,
Miaohe Lin <linmiaohe@huawei.com>,
Vladimir Davydov <vdavydov.dev@gmail.com>,
linux-mm@kvack.org, cgroups@vger.kernel.org
Subject: Re: [PATCH] memcg: page_cgroup_ino() get memcg from compound_head(page)
Date: Tue, 14 Mar 2023 12:45:23 -0700 [thread overview]
Message-ID: <CAJD7tkbaDeRP6-WuRGuRdhnOSV26=G_jhqMnejHQFGiT8VZ0bw@mail.gmail.com> (raw)
In-Reply-To: <ZBBGGFi0U8r67S5E@dhcp22.suse.cz>
On Tue, Mar 14, 2023 at 3:02 AM Michal Hocko <mhocko@suse.com> wrote:
>
> On Mon 13-03-23 14:08:53, Yosry Ahmed wrote:
> > On Mon, Mar 13, 2023 at 12:44 PM Andrew Morton
> > <akpm@linux-foundation.org> wrote:
> > >
> > > On Mon, 13 Mar 2023 08:34:52 +0000 Yosry Ahmed <yosryahmed@google.com> wrote:
> > >
> > > > From: Hugh Dickins <hughd@google.com>
> > > >
> > > > In a kernel with added WARN_ON_ONCE(PageTail) in page_memcg_check(), we
> > > > observed a warning from page_cgroup_ino() when reading
> > > > /proc/kpagecgroup.
> > >
> > > If this is the only known situation in which page_memcg_check() is
> > > passed a tail page, why does page_memcg_check() have
> > >
> > > if (PageTail(page))
> > > return NULL;
> > >
> > > ? Can we remove this to simplify, streamline and clarify?
> >
> > I guess it's a safety check so that we don't end up trying to cast a
> > tail page to a folio. My opinion is to go one step further and change
> > page_memcg_check() to do return the memcg of the head page, i.e:
> >
> > static inline struct mem_cgroup *page_memcg_check(struct page *page)
> > {
> > return folio_memcg_check(page_folio(page));
> > }
>
> I would just stick with the existing code and put a comment that this
> function shouldn't be used in any new code and the folio counterpart
> should be used instead.
Would you mind explaining the rationale?
If existing users are not passing in tail pages and we are telling new
users not to use it, what's the point of leaving the PageTail() check?
Is page owner doing the right thing by discounting pages with
page->memcg_data = 0 in print_page_owner_memcg() ? Wouldn't this not
show the memcg of tail pages?
If page owner also needs a compound_head()/ page_folio() call before
checking the page memcg, perhaps we should convert both call sites to
page_memcg_check() to folio_memcg_check() and remove it now?
>
> --
> Michal Hocko
> SUSE Labs
next prev parent reply other threads:[~2023-03-14 19:46 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-13 8:34 Yosry Ahmed
2023-03-13 19:44 ` Andrew Morton
2023-03-13 21:08 ` Yosry Ahmed
2023-03-14 10:02 ` Michal Hocko
2023-03-14 19:45 ` Yosry Ahmed [this message]
2023-03-14 19:46 ` Yosry Ahmed
2023-03-15 2:34 ` Roman Gushchin
2023-03-15 2:39 ` Yosry Ahmed
2023-03-15 3:06 ` Waiman Long
2023-03-15 3:10 ` Yosry Ahmed
2023-03-15 3:33 ` Waiman Long
2023-03-15 3:40 ` Yosry Ahmed
2023-03-15 4:54 ` Matthew Wilcox
2023-03-15 7:04 ` Yosry Ahmed
2023-03-15 12:19 ` Matthew Wilcox
2023-03-15 21:43 ` Yosry Ahmed
2023-03-16 0:09 ` Waiman Long
2023-03-16 0:25 ` Yosry Ahmed
2023-03-16 3:07 ` Matthew Wilcox
2023-03-16 3:16 ` Yosry Ahmed
2023-03-22 6:52 ` Yosry Ahmed
2023-03-14 10:00 ` Michal Hocko
2023-03-15 2:37 ` Yosry Ahmed
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='CAJD7tkbaDeRP6-WuRGuRdhnOSV26=G_jhqMnejHQFGiT8VZ0bw@mail.gmail.com' \
--to=yosryahmed@google.com \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=hughd@google.com \
--cc=linmiaohe@huawei.com \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=muchun.song@linux.dev \
--cc=naoya.horiguchi@nec.com \
--cc=roman.gushchin@linux.dev \
--cc=shakeelb@google.com \
--cc=vdavydov.dev@gmail.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