Re: [RFC PATCH V2 2/4] mm: Add get_user_pages_cma_migrate

From: Aneesh Kumar K.V
Date: Thu Sep 06 2018 - 09:24:09 EST


On 09/06/2018 06:15 PM, Michal Hocko wrote:
On Thu 06-09-18 11:13:40, Aneesh Kumar K.V wrote:
This helper does a get_user_pages_fast and if it find pages in the CMA area
it will try to migrate them before taking page reference. This makes sure that
we don't keep non-movable pages (due to page reference count) in the CMA area.
Not able to move pages out of CMA area result in CMA allocation failures.

Again, there is no user so it is hard to guess the intention completely.
There is no documentation to describe the expected context and
assumptions about locking etc.


patch 4 is the user for the new helper. I will add the documentation update.

As noted in the previous email. You should better describe why you are
bypassing hugetlb pools. I assume that the reason is to guarantee a
forward progress because those might be sitting in the CMA pools
already, right?


The reason for that is explained in the code

+ struct hstate *h = page_hstate(page);
+ /*
+ * We don't want to dequeue from the pool because pool pages will
+ * mostly be from the CMA region.
+ */
+ return alloc_migrate_huge_page(h, gfp_mask, nid, NULL);

-aneesh