Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1446780

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

From David Rientjes <rientjes@google.com>
Newsgroups linux.kernel
Subject Re: [PATCH 5/8] mm, page_alloc: make THP-specific decisions more generic
Date 2016-07-20 01:20 +0200
Message-ID <rWMsV-1T0-3@gated-at.bofh.it> (permalink)
References <rWeUh-5vO-7@gated-at.bofh.it> <rWeUi-5vO-49@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, 18 Jul 2016, Vlastimil Babka wrote:

> Since THP allocations during page faults can be costly, extra decisions are
> employed for them to avoid excessive reclaim and compaction, if the initial
> compaction doesn't look promising. The detection has never been perfect as
> there is no gfp flag specific to THP allocations. At this moment it checks the
> whole combination of flags that makes up GFP_TRANSHUGE, and hopes that no other
> users of such combination exist, or would mind being treated the same way.
> Extra care is also taken to separate allocations from khugepaged, where latency
> doesn't matter that much.
> 
> It is however possible to distinguish these allocations in a simpler and more
> reliable way. The key observation is that after the initial compaction followed
> by the first iteration of "standard" reclaim/compaction, both __GFP_NORETRY
> allocations and costly allocations without __GFP_REPEAT are declared as
> failures:
> 
>         /* Do not loop if specifically requested */
>         if (gfp_mask & __GFP_NORETRY)
>                 goto nopage;
> 
>         /*
>          * Do not retry costly high order allocations unless they are
>          * __GFP_REPEAT
>          */
>         if (order > PAGE_ALLOC_COSTLY_ORDER && !(gfp_mask & __GFP_REPEAT))
>                 goto nopage;
> 
> 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@suse.cz>
> Acked-by: Michal Hocko <mhocko@suse.com>

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.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/8] compaction-related cleanups v4 Vlastimil Babka <vbabka@suse.cz> - 2016-07-18 13:30 +0200
  [PATCH 7/8] mm, compaction: introduce direct compaction priority Vlastimil Babka <vbabka@suse.cz> - 2016-07-18 13:30 +0200
  [PATCH 4/8] mm, page_alloc: restructure direct compaction handling in slowpath Vlastimil Babka <vbabka@suse.cz> - 2016-07-18 13:30 +0200
    Re: [PATCH 4/8] mm, page_alloc: restructure direct compaction handling  in slowpath David Rientjes <rientjes@google.com> - 2016-07-20 01:00 +0200
      Re: [PATCH 4/8] mm, page_alloc: restructure direct compaction  handling in slowpath Vlastimil Babka <vbabka@suse.cz> - 2016-07-20 18:10 +0200
  [PATCH 5/8] mm, page_alloc: make THP-specific decisions more generic Vlastimil Babka <vbabka@suse.cz> - 2016-07-18 13:30 +0200
    Re: [PATCH 5/8] mm, page_alloc: make THP-specific decisions more  generic David Rientjes <rientjes@google.com> - 2016-07-20 01:20 +0200
      Re: [PATCH 5/8] mm, page_alloc: make THP-specific decisions more  generic Vlastimil Babka <vbabka@suse.cz> - 2016-07-21 09:20 +0200
  [PATCH 6/8] mm, thp: remove __GFP_NORETRY from khugepaged and madvised allocations Vlastimil Babka <vbabka@suse.cz> - 2016-07-18 13:30 +0200
  [PATCH 1/8] mm, compaction: don't isolate PageWriteback pages in MIGRATE_SYNC_LIGHT mode Vlastimil Babka <vbabka@suse.cz> - 2016-07-18 13:30 +0200
    Re: [PATCH 1/8] mm, compaction: don't isolate PageWriteback pages  in MIGRATE_SYNC_LIGHT mode David Rientjes <rientjes@google.com> - 2016-07-20 00:30 +0200
  [PATCH 2/8] mm, page_alloc: set alloc_flags only once in slowpath Vlastimil Babka <vbabka@suse.cz> - 2016-07-18 13:30 +0200
    Re: [PATCH 2/8] mm, page_alloc: set alloc_flags only once in  slowpath David Rientjes <rientjes@google.com> - 2016-07-20 00:30 +0200
      Re: [PATCH 2/8] mm, page_alloc: set alloc_flags only once in slowpath Vlastimil Babka <vbabka@suse.cz> - 2016-07-21 09:10 +0200
  Re: [PATCH 0/8] compaction-related cleanups v4 Michal Hocko <mhocko@kernel.org> - 2016-07-18 13:40 +0200
  Re: [PATCH 0/8] compaction-related cleanups v4 Mel Gorman <mgorman@techsingularity.net> - 2016-07-18 17:50 +0200

csiph-web