On Wed 17-03-21 12:12:50, Oscar Salvador wrote:
> alloc_contig_range() will fail if it finds a HugeTLB page within the range,
> without a chance to handle them. Since HugeTLB pages can be migrated as any
> LRU or Movable page, it does not make sense to bail out without trying.
> Enable the interface to recognize in-use HugeTLB pages so we can migrate
> them, and have much better chances to succeed the call.
> 
> Signed-off-by: Oscar Salvador <osalva...@suse.de>
> Reviewed-by: Mike Kravetz <mike.krav...@oracle.com>

Acked-by: Michal Hocko <mho...@suse.com>

I am still not entirely happy about this
> @@ -2347,7 +2351,19 @@ int isolate_or_dissolve_huge_page(struct page *page)
>       if (hstate_is_gigantic(h))
>               return -ENOMEM;
>  
> -     return alloc_and_dissolve_huge_page(h, head);
> +retry:
> +     if (page_count(head) && isolate_huge_page(head, list)) {
> +             ret = 0;
> +     } else if (!page_count(head)) {
> +             ret = alloc_and_dissolve_huge_page(h, head);
> +
> +             if (ret == -EBUSY && try_again) {
> +                     try_again = false;
> +                     goto retry;
> +             }
> +     }
> +
> +     return ret;
>  }

it would be imho better to retry inside alloc_and_dissolve_huge_page
because it already has its retry logic implemented.

But not something I will insist on.

-- 
Michal Hocko
SUSE Labs

Reply via email to