Re: [PATCH] memcontrol: only transfer the memcg data for migration

From: Yosry Ahmed
Date: Tue Oct 03 2023 - 19:55:12 EST


On Tue, Oct 3, 2023 at 4:31 PM Nhat Pham <nphamcs@xxxxxxxxx> wrote:
>
> On Tue, Oct 3, 2023 at 4:22 PM Yosry Ahmed <yosryahmed@xxxxxxxxxx> wrote:
> >
> > On Tue, Oct 3, 2023 at 4:14 PM Nhat Pham <nphamcs@xxxxxxxxx> wrote:
> > >
> > > For most migration use cases, only transfer the memcg data from the old
> > > folio to the new folio, and clear the old folio's memcg data. No
> > > charging and uncharging will be done. These use cases include the new
> > > hugetlb memcg accounting behavior (which was not previously handled).
> > >
> > > This shaves off some work on the migration path, and avoids the
> > > temporary double charging of a folio during its migration.
> > >
> > > The only exception is replace_page_cache_folio(), which will use the old
> > > mem_cgroup_migrate() (now renamed to mem_cgroup_replace_folio). In that
> > > context, the isolation of the old page isn't quite as thorough as with
> > > migration, so we cannot use our new implementation directly.
> > >
> > > This patch is the result of the following discussion on the new hugetlb
> > > memcg accounting behavior:
> > >
> > > https://lore.kernel.org/lkml/20231003171329.GB314430@monkey/
> > >
> > > Reported-by: Mike Kravetz <mike.kravetz@xxxxxxxxxx>
> > > Closes: https://lore.kernel.org/lkml/20231003171329.GB314430@monkey/
> > > Suggested-by: Johannes Weiner <hannes@xxxxxxxxxxx>
> > > Signed-off-by: Nhat Pham <nphamcs@xxxxxxxxx>
> >
> > Does this patch fit before or after your series? In both cases I think
> > there might be a problem for bisectability.
>
> Hmm my intention for this patch is as a fixlet.
> (i.e it should be eventually squashed to the second patch of that series).
> I just include the extra context on the fixlet for review purposes.
>
> My apologies - should have been much clearer.
> (Perhaps I should just send out v4 at this point?)
>

It's really up to Andrew, just make it clear what the intention is.

Thanks!