Re: [PATCH v4 07/11] mm/gup: use a standard migration target allocation callback
From: Michal Hocko
Date: Tue Jul 07 2020 - 07:46:20 EST
On Tue 07-07-20 16:44:45, Joonsoo Kim wrote:
[...]
> @@ -1551,9 +1552,12 @@ struct page *alloc_migration_target(struct page *page, unsigned long private)
>
> gfp_mask |= htlb_alloc_mask(h);
> return alloc_huge_page_nodemask(h, nid, mtc->nmask,
> - gfp_mask, false);
> + gfp_mask, mtc->skip_cma);
> }
>
> + if (mtc->skip_cma)
> + flags = memalloc_nocma_save();
> +
As already mentioned in previous email this is a completely wrong usage
of the scope API. The scope should be defined by the caller and this
should be all transparent by the allocator layer.
> if (PageTransHuge(page)) {
> /*
> * clear __GFP_RECALIM since GFP_TRANSHUGE is the gfp_mask
> @@ -1572,6 +1576,9 @@ struct page *alloc_migration_target(struct page *page, unsigned long private)
> if (new_page && PageTransHuge(new_page))
> prep_transhuge_page(new_page);
>
> + if (mtc->skip_cma)
> + memalloc_nocma_restore(flags);
> +
> return new_page;
> }
>
> --
> 2.7.4
--
Michal Hocko
SUSE Labs