Re: [RFC PATCH 2/3] hugetlb: convert page_huge_active() to HPageMigratable flag

From: Oscar Salvador
Date: Fri Jan 15 2021 - 15:38:49 EST


On Fri, Jan 15, 2021 at 09:43:36AM -0800, Mike Kravetz wrote:
> > Before the page_huge_active() in scan_movable_pages() we have the
> > if (!PageHuge(page)) check, but could it be that between that check and
> > the page_huge_active(), the page gets dissolved, and so we are checking
> > a wrong page[1]? Am I making sense?
>
> Yes, you are making sense.
>
> The reason I decided to drop the check is because it does not eliminate the
> race. Even with that check in page_huge_active, the page could be dissolved
> between that check and check of page[1]. There really is no way to eliminate
> the race without holding a reference to the page (or hugetlb_lock). That
> check in page_huge_active just shortens the race window.

Yeah, you are right, the race already exists.
Anyway, do_migrate_range should take care of making sure what it is
handling, so I think we are good.

--
Oscar Salvador
SUSE L3