Re: [PATCH v3 2/2] mm: Make alloc_contig_range handle in-use hugetlb pages
From: Michal Hocko
Date: Fri Feb 26 2021 - 03:47:55 EST
On Mon 22-02-21 14:51:37, Oscar Salvador wrote:
[...]
> @@ -2394,9 +2397,19 @@ bool isolate_or_dissolve_huge_page(struct page *page)
> */
> if (hstate_is_gigantic(h))
> return ret;
> -
> - if (!page_count(head) && alloc_and_dissolve_huge_page(h, head))
> +retry:
> + if (page_count(head) && isolate_huge_page(head, list)) {
> ret = true;
> + } else if (!page_count(head)) {
This is rather head spinning. Do we need to test page_count in the else
branch? Do you want to optimize for a case where the page cannot be
isolated because of page_huge_active?
> + int err = alloc_and_dissolve_huge_page(h, head);
> +
> + if (!err) {
> + ret = true;
> + } else if (err == -EBUSY && try_again) {
> + try_again = false;
> + goto retry;
> + }
Is this retry once logic really needed? Does it really give us any real
benefit? alloc_and_dissolve_huge_page already retries when the page is
being freed.
--
Michal Hocko
SUSE Labs