On Wed, 20 Jul 2016, Vlastimil Babka wrote:

> >> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> >> index eb1968a1041e..30443804f156 100644
> >> --- a/mm/page_alloc.c
> >> +++ b/mm/page_alloc.c
> >> @@ -3541,35 +3541,42 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned 
> >> int order,
> >>     */
> >>    alloc_flags = gfp_to_alloc_flags(gfp_mask);
> >>  
> >> +  if (gfp_mask & __GFP_KSWAPD_RECLAIM)
> >> +          wake_all_kswapds(order, ac);
> >> +
> >> +  /*
> >> +   * The adjusted alloc_flags might result in immediate success, so try
> >> +   * that first
> >> +   */
> >> +  page = get_page_from_freelist(gfp_mask, order, alloc_flags, ac);
> >> +  if (page)
> >> +          goto got_pg;
> > 
> > Any reason to not test gfp_pfmemalloc_allowed() here?  For contexts where 
> > it returns true, it seems like the above would be an unneeded failure if 
> > ALLOC_WMARK_MIN would have failed.  No strong opinion.
> 
> Yeah, two reasons:
> 1 - less overhead (for the test) if we went to slowpath just to wake up
> kswapd and then succeed on min watermark
> 2 - try all zones with min watermark before resorting to no watermark
> (if allowed), so we don't needlessly put below min watermark the first
> zone in zonelist, while some later zone would still be above watermark
> 

The second point makes sense, thanks!

Acked-by: David Rientjes <rient...@google.com>

Reply via email to