From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751348AbcFWOl7 (ORCPT ); Thu, 23 Jun 2016 10:41:59 -0400 Received: from mx2.suse.de ([195.135.220.15]:34256 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750890AbcFWOl6 (ORCPT ); Thu, 23 Jun 2016 10:41:58 -0400 Subject: Re: [PATCH v2 12/18] mm, compaction: more reliably increase direct compaction priority To: Michal Hocko References: <20160531130818.28724-1-vbabka@suse.cz> <20160531130818.28724-13-vbabka@suse.cz> <20160601135124.GS26601@dhcp22.suse.cz> Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Mel Gorman , Joonsoo Kim , David Rientjes , Rik van Riel From: Vlastimil Babka Message-ID: <977bc795-d2e7-ee7b-df2e-a30ce5cf15cc@suse.cz> Date: Thu, 23 Jun 2016 16:41:53 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <20160601135124.GS26601@dhcp22.suse.cz> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/01/2016 03:51 PM, Michal Hocko wrote: > On Tue 31-05-16 15:08:12, Vlastimil Babka wrote: >> During reclaim/compaction loop, compaction priority can be increased by the >> should_compact_retry() function, but the current code is not optimal. Priority >> is only increased when compaction_failed() is true, which means that compaction >> has scanned the whole zone. This may not happen even after multiple attempts >> with the lower priority due to parallel activity, so we might needlessly >> struggle on the lower priority. >> >> We can remove these corner cases by increasing compaction priority regardless >> of compaction_failed(). Examining further the compaction result can be >> postponed only after reaching the highest priority. This is a simple solution >> and we don't need to worry about reaching the highest priority "too soon" here, >> because hen should_compact_retry() is called it means that the system is >> already struggling and the allocation is supposed to either try as hard as >> possible, or it cannot fail at all. There's not much point staying at lower >> priorities with heuristics that may result in only partial compaction. >> >> The only exception here is the COMPACT_SKIPPED result, which means that >> compaction could not run at all due to being below order-0 watermarks. In that >> case, don't increase compaction priority, and check if compaction could proceed >> when everything reclaimable was reclaimed. Before this patch, this was tied to >> compaction_withdrawn(), but the other results considered there are in fact only >> possible due to low compaction priority so we can ignore them thanks to the >> patch. Since there are no other callers of compaction_withdrawn(), remove it. > > I agree with the change in general. I think that keeping compaction_withdrawn > even with a single check is better because it abstracts the fact from a > specific constant. OK. > Now that I think about that some more I guess you also want to update > compaction_retries inside should_compact_retry as well, or at least > update it only when we have reached the lowest priority. What do you > think? Makes sense, especially that after your suggestion, should_compact_retry() is not reached as long as should_reclaim_retry() returnes true. So I will do that. >> Signed-off-by: Vlastimil Babka > > Other than that this makes sense > Acked-by: Michal Hocko Thanks!