[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALvZod4UuGizMkt2Ww55PDbtdr1DxfJ6mbDUa5BA221u8ddUsA@mail.gmail.com>
Date: Thu, 18 Jun 2020 18:18:07 -0700
From: Shakeel Butt <shakeelb@...gle.com>
To: Roman Gushchin <guro@...com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Christoph Lameter <cl@...ux.com>,
Johannes Weiner <hannes@...xchg.org>,
Michal Hocko <mhocko@...nel.org>,
Linux MM <linux-mm@...ck.org>,
Vlastimil Babka <vbabka@...e.cz>,
Kernel Team <kernel-team@...com>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v6 05/19] mm: memcontrol: decouple reference counting from
page accounting
On Thu, Jun 18, 2020 at 6:08 PM Roman Gushchin <guro@...com> wrote:
>
> On Thu, Jun 18, 2020 at 07:55:35AM -0700, Shakeel Butt wrote:
> > Not sure if my email went through, so, re-sending.
> >
> > On Mon, Jun 8, 2020 at 4:07 PM Roman Gushchin <guro@...com> wrote:
> > >
> > > From: Johannes Weiner <hannes@...xchg.org>
> > >
> > [...]
> > > @@ -3003,13 +3004,16 @@ void __memcg_kmem_uncharge_page(struct page *page, int order)
> > > */
> > > void mem_cgroup_split_huge_fixup(struct page *head)
> > > {
> > > + struct mem_cgroup *memcg = head->mem_cgroup;
> > > int i;
> > >
> > > if (mem_cgroup_disabled())
> > > return;
> > >
> >
> > A memcg NULL check is needed here.
>
> Hm, it seems like the only way how it can be NULL is if mem_cgroup_disabled() is true:
>
> int mem_cgroup_charge(struct page *page, struct mm_struct *mm, gfp_t gfp_mask)
> {
> unsigned int nr_pages = hpage_nr_pages(page);
> struct mem_cgroup *memcg = NULL;
> int ret = 0;
>
> if (mem_cgroup_disabled())
> goto out;
>
> <...>
>
> if (!memcg)
> memcg = get_mem_cgroup_from_mm(mm);
>
> ret = try_charge(memcg, gfp_mask, nr_pages);
> if (ret)
> goto out_put;
>
> css_get(&memcg->css);
> commit_charge(page, memcg);
>
>
> Did you hit this issue in reality? The only possible scenario I can imagine
> is if the page was allocated before enabling memory cgroups.
>
> Are you about this case?
>
> Otherwise we put root_mem_cgroup there.
>
Oh yes, you are right. I am confusing this with kmem pages for root
memcg where we don't set the page->mem_cgroup and this patch series
should be changing that.
Shakeel
Powered by blists - more mailing lists