Re: linux-next: manual merge of the akpm-current tree with the bpf-next tree

From: Roman Gushchin
Date: Mon Dec 14 2020 - 20:31:44 EST


On Tue, Dec 15, 2020 at 07:21:56AM +1100, Stephen Rothwell wrote:
> Hi all,
>
> On Fri, 4 Dec 2020 20:20:05 +1100 Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx> wrote:
> >
> > Today's linux-next merge of the akpm-current tree got conflicts in:
> >
> > include/linux/memcontrol.h
> > mm/memcontrol.c
> >
> > between commit:
> >
> > bcfe06bf2622 ("mm: memcontrol: Use helpers to read page's memcg data")
> >
> > from the bpf-next tree and commits:
> >
> > 6771a349b8c3 ("mm/memcg: remove incorrect comment")
> > c3970fcb1f21 ("mm: move lruvec stats update functions to vmstat.h")
> >
> > from the akpm-current tree.
> >
> > I fixed it up (see below - I used the latter version of memcontrol.h)
> > and can carry the fix as necessary. This is now fixed as far as
> > linux-next is concerned, but any non trivial conflicts should be
> > mentioned to your upstream maintainer when your tree is submitted for
> > merging. You may also want to consider cooperating with the maintainer
> > of the conflicting tree to minimise any particularly complex conflicts.
> >
> > I also added this merge fix patch:
> >
> > From: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
> > Date: Fri, 4 Dec 2020 19:53:40 +1100
> > Subject: [PATCH] fixup for "mm: move lruvec stats update functions to vmstat.h"
> >
> > conflict against "mm: memcontrol: Use helpers to read page's memcg data"
> >
> > Signed-off-by: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
> > ---
> > mm/memcontrol.c | 5 +++--
> > 1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> > index 6f5733779927..3b6db4e906b5 100644
> > --- a/mm/memcontrol.c
> > +++ b/mm/memcontrol.c
> > @@ -851,16 +851,17 @@ void __mod_lruvec_page_state(struct page *page, enum node_stat_item idx,
> > int val)
> > {
> > struct page *head = compound_head(page); /* rmap on tail pages */
> > + struct mem_cgroup *memcg = page_memcg(head);
> > pg_data_t *pgdat = page_pgdat(page);
> > struct lruvec *lruvec;
> >
> > /* Untracked pages have no memcg, no lruvec. Update only the node */
> > - if (!head->mem_cgroup) {
> > + if (!memcg) {
> > __mod_node_page_state(pgdat, idx, val);
> > return;
> > }
> >
> > - lruvec = mem_cgroup_lruvec(head->mem_cgroup, pgdat);
> > + lruvec = mem_cgroup_lruvec(memcg, pgdat);
> > __mod_lruvec_state(lruvec, idx, val);
> > }
> >
> > --
> > 2.29.2
> >
> > --
> > Cheers,
> > Stephen Rothwell
> >
> > diff --cc include/linux/memcontrol.h
> > index 320369c841f5,ff02f831e7e1..000000000000
> > --- a/include/linux/memcontrol.h
> > +++ b/include/linux/memcontrol.h
> > diff --cc mm/memcontrol.c
> > index 7535042ac1ec,c9a5dce4343d..000000000000
> > --- a/mm/memcontrol.c
> > +++ b/mm/memcontrol.c
> > @@@ -2880,9 -2984,9 +2975,9 @@@ static void cancel_charge(struct mem_cg
> >
> > static void commit_charge(struct page *page, struct mem_cgroup *memcg)
> > {
> > - VM_BUG_ON_PAGE(page->mem_cgroup, page);
> > + VM_BUG_ON_PAGE(page_memcg(page), page);
> > /*
> > - * Any of the following ensures page->mem_cgroup stability:
> > + * Any of the following ensures page's memcg stability:
> > *
> > * - the page lock
> > * - LRU isolation
> > @@@ -6977,11 -7012,10 +6997,10 @@@ void mem_cgroup_migrate(struct page *ol
> > return;
> >
> > /* Page cache replacement: new page already charged? */
> > - if (newpage->mem_cgroup)
> > + if (page_memcg(newpage))
> > return;
> >
> > - /* Swapcache readahead pages can get replaced before being charged */
> > - memcg = oldpage->mem_cgroup;
> > + memcg = page_memcg(oldpage);
> > if (!memcg)
> > return;
> >
>
> Just a reminder that this conflict still exists. Commit bcfe06bf2622
> is now in the net-next tree.

Thanks, Stephen!

I wonder if it's better to update these 2 commits in the mm tree to avoid
conflicts?

Basically split your fix into two and merge it into mm commits.
The last chunk in the patch should be merged into "mm/memcg: remove incorrect comment".
And the rest into "mm: move lruvec stats update functions to vmstat.h".

Andrew, what do you think?

Thanks!