On 6/23/20 8:13 AM, js1304@xxxxxxxxx wrote: > From: Joonsoo Kim <iamjoonsoo.kim@xxxxxxx> > > There is a well-defined migration target allocation callback. > It's mostly similar with new_non_cma_page() except considering CMA pages. > > This patch adds a CMA consideration to the standard migration target > allocation callback and use it on gup.c. > > Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@xxxxxxx> Acked-by: Vlastimil Babka <vbabka@xxxxxxx> But a suggestion below. > --- > mm/gup.c | 57 ++++++++------------------------------------------------- > mm/internal.h | 1 + > mm/migrate.c | 4 +++- > 3 files changed, 12 insertions(+), 50 deletions(-) > > diff --git a/mm/gup.c b/mm/gup.c > index 15be281..f6124e3 100644 > --- a/mm/gup.c > +++ b/mm/gup.c > @@ -1608,56 +1608,15 @@ static bool check_dax_vmas(struct vm_area_struct **vmas, long nr_pages) > } > > #ifdef CONFIG_CMA > -static struct page *new_non_cma_page(struct page *page, unsigned long private) > +static struct page *alloc_migration_target_non_cma(struct page *page, unsigned long private) > { ... > + struct migration_target_control mtc = { > + .nid = page_to_nid(page), > + .gfp_mask = GFP_USER | __GFP_NOWARN, > + .skip_cma = true, > + }; > > - return __alloc_pages_node(nid, gfp_mask, 0); > + return alloc_migration_target(page, (unsigned long)&mtc); Do we really need this wrapper? The only user is check_and_migrate_cma_pages so just opencode it?