Re: [PATCH 5/8] mm, page_alloc: make THP-specific decisions more generic

From: Vlastimil Babka
Date: Thu Jul 21 2016 - 03:13:48 EST


On 07/20/2016 01:10 AM, David Rientjes wrote:
On Mon, 18 Jul 2016, Vlastimil Babka wrote:

This means we can further distinguish allocations that are costly order *and*
additionally include the __GFP_NORETRY flag. As it happens, GFP_TRANSHUGE
allocations do already fall into this category. This will also allow other
costly allocations with similar high-order benefit vs latency considerations to
use this semantic. Furthermore, we can distinguish THP allocations that should
try a bit harder (such as from khugepageed) by removing __GFP_NORETRY, as will
be done in the next patch.

Signed-off-by: Vlastimil Babka <vbabka@xxxxxxx>
Acked-by: Michal Hocko <mhocko@xxxxxxxx>

I think this is fine, but I would hope that we could check
gfp_pfmemalloc_allowed() before compacting and failing even for costly
orders when otherwise the first get_page_from_freelist() in the slowpath
may have succeeded due to watermarks.

Hm ok, I will add it for the sake of avoiding goto nopage where previously it would have tried alloc without watermarks, as that would be unintended side-effect of the series... although I have some doubts about sanity of such scenarios (wants a costly order, can reclaim/compact but only with __GFP_NORETRY, yet is allowed to avoid watermarks?). Do you know about examples of such callers and think they do the right thing?

Thanks,
Vlastimil