Re: [PATCH 09/11] mm, compaction: Abstract compaction feedback to helpers

From: Vlastimil Babka
Date: Tue Apr 12 2016 - 07:53:56 EST


On 04/11/2016 05:14 PM, Michal Hocko wrote:
On Mon 11-04-16 16:39:21, Vlastimil Babka wrote:
On 04/05/2016 01:25 PM, Michal Hocko wrote:
[...]
+/* Compaction has failed and it doesn't make much sense to keep retrying. */
+static inline bool compaction_failed(enum compact_result result)
+{
+ /* All zones where scanned completely and still not result. */

Hmm given that try_to_compact_pages() uses a max() on results, then in fact
it takes only one zone to get this. Others could have been also SKIPPED or
DEFERRED. Is that what you want?

In short I didn't find any better way and still guarantee a some
guarantee of convergence. COMPACT_COMPLETE means that at least one zone
was completely scanned and led to no result. That zone would be
compact_suitable by definition. If I made DEFERRED or SKIPPED more
priorite (aka higher in the enum) then I could easily end up in a state
where all zones would return COMPACT_COMPLETE and few remaining would
just alternate returning their DEFFERED resp. SKIPPED. So while this
might sound like giving up too early I couldn't come up with anything
more specific that would lead to reliable results.

I am open to any suggestions of course.

I guess you would have to track each zone separately and make sure you've seen COMPACT_COMPLETE in all of them, although not necessary during the same zonelist attempt. But then do the same for reclaim, as you would also have to match COMPAT_SKIPPED and inability of reclaim... and that gets uglier and uglier, and also against the move to node-based reclaim...

So there's a danger that you'll see COMPACT_COMPLETE on a small ZONE_DMA early on, before the larger zones even stop being deferred, but I don't see an easy solution.