Re: [PATCH RESEND 0/8] hugetlb: add demote/split page functionality

Michal Hocko
2021-09-13T15:51:09Z

On Fri 10-09-21 17:11:05, Mike Kravetz wrote:
[...]
> @@ -5064,8 +5068,18 @@ bool gfp_pfmemalloc_allowed(gfp_t gfp_mask)
> if (did_some_progress > 0 &&
> should_compact_retry(ac, order, alloc_flags,
> compact_result, &compact_priority,
> - &compaction_retries))
> + &compaction_retries)) {
> + /*
> + * In one pathological case, pages can be stolen immediately
> + * after reclaimed. It looks like we are making progress, and
> + * compaction_retries is not incremented. This could cause
> + * an indefinite number of retries. Cap the number of retries
> + * for costly orders.
> + */
> + if (max_tries && tries > max_tries)
> + goto nopage;
> goto retry;
> + }

I do not think this is a good approach. We do not want to play with
retries numbers. If we want to go with a minimal change for now then the
compaction feedback mechanism should track the number of reclaimed pages
to satisfy watermarks and if that grows beyond reasonable (proportionaly
to the request size) then simply give up rather than keep trying again
and again.

--
Michal Hocko
SUSE Labs