[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAmzW4MdTstiqEccFsw61HHyim2uutA8jd23reX-kOtDnXmzDQ@mail.gmail.com>
Date: Thu, 9 Jul 2020 12:25:30 +0900
From: Joonsoo Kim <js1304@...il.com>
To: Vlastimil Babka <vbabka@...e.cz>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Linux Memory Management List <linux-mm@...ck.org>,
LKML <linux-kernel@...r.kernel.org>, kernel-team@....com,
Christoph Hellwig <hch@...radead.org>,
Roman Gushchin <guro@...com>,
Mike Kravetz <mike.kravetz@...cle.com>,
Naoya Horiguchi <n-horiguchi@...jp.nec.com>,
Michal Hocko <mhocko@...e.com>,
Joonsoo Kim <iamjoonsoo.kim@....com>
Subject: Re: [PATCH v4 11/11] mm/memory_hotplug: remove a wrapper for alloc_migration_target()
2020년 7월 8일 (수) 오전 1:34, Vlastimil Babka <vbabka@...e.cz>님이 작성:
>
> On 7/7/20 9:44 AM, js1304@...il.com wrote:
> > From: Joonsoo Kim <iamjoonsoo.kim@....com>
> >
> > To calculate the correct node to migrate the page for hotplug, we need
> > to check node id of the page. Wrapper for alloc_migration_target() exists
> > for this purpose.
> >
> > However, Vlastimil informs that all migration source pages come from
> > a single node. In this case, we don't need to check the node id for each
> > page and we don't need to re-set the target nodemask for each page by
> > using the wrapper. Set up the migration_target_control once and use it for
> > all pages.
> >
> > Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@....com>
>
> Acked-by: Vlastimil Babka <vbabka@...e.cz>
>
> Thanks! Nitpick below.
>
> > @@ -1345,9 +1324,28 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)
> > put_page(page);
> > }
> > if (!list_empty(&source)) {
> > - /* Allocate a new page from the nearest neighbor node */
> > - ret = migrate_pages(&source, new_node_page, NULL, 0,
> > - MIGRATE_SYNC, MR_MEMORY_HOTPLUG);
> > + nodemask_t nmask = node_states[N_MEMORY];
> > + struct migration_target_control mtc = {
> > + .nmask = &nmask,
> > + .gfp_mask = GFP_USER | __GFP_MOVABLE | __GFP_RETRY_MAYFAIL,
> > + };
> > +
> > + /*
> > + * We have checked that migration range is on a single zone so
> > + * we can use the nid of the first page to all the others.
> > + */
> > + mtc.nid = page_to_nid(list_first_entry(&source, struct page, lru));
> > +
> > + /*
> > + * try to allocate from a different node but reuse this node
> > + * if there are no other online nodes to be used (e.g. we are
> > + * offlining a part of the only existing node)
> > + */
> > + node_clear(mtc.nid, *mtc.nmask);
> > + if (nodes_empty(*mtc.nmask))
> > + node_set(mtc.nid, *mtc.nmask);
>
> You could have kept using 'nmask' instead of '*mtc.nmask'. Actually that applies
> to patch 6 too, for less churn.
You are right. I will change it.
Thanks.
Powered by blists - more mailing lists