From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752636AbcFBCte (ORCPT ); Wed, 1 Jun 2016 22:49:34 -0400 Received: from LGEAMRELO13.lge.com ([156.147.23.53]:49021 "EHLO lgeamrelo13.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752261AbcFBCtd (ORCPT ); Wed, 1 Jun 2016 22:49:33 -0400 X-Original-SENDERIP: 156.147.1.121 X-Original-MAILFROM: iamjoonsoo.kim@lge.com X-Original-SENDERIP: 10.177.222.138 X-Original-MAILFROM: iamjoonsoo.kim@lge.com Date: Thu, 2 Jun 2016 11:50:50 +0900 From: Joonsoo Kim To: Vlastimil Babka Cc: Michal Hocko , linux-mm@kvack.org, Andrew Morton , Rik van Riel , David Rientjes , Mel Gorman , Johannes Weiner , Tetsuo Handa , linux-kernel@vger.kernel.org, Linus Torvalds Subject: Re: [RFC 12/13] mm, compaction: more reliably increase direct compaction priority Message-ID: <20160602025050.GC9133@js1304-P5Q-DELUXE> References: <1462865763-22084-1-git-send-email-vbabka@suse.cz> <1462865763-22084-13-git-send-email-vbabka@suse.cz> <20160531063740.GC30967@js1304-P5Q-DELUXE> <276c5490-c5e3-2ba5-68d8-df02922f6122@suse.cz> <8c3efbf0-6c05-273d-5d35-bd0b386a20ec@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8c3efbf0-6c05-273d-5d35-bd0b386a20ec@suse.cz> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 31, 2016 at 02:29:24PM +0200, Vlastimil Babka wrote: > On 05/31/2016 02:07 PM, Vlastimil Babka wrote: > >On 05/31/2016 08:37 AM, Joonsoo Kim wrote: > >>>@@ -3695,22 +3695,22 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, > >>> else > >>> no_progress_loops++; > >>> > >>>- if (should_reclaim_retry(gfp_mask, order, ac, alloc_flags, > >>>- did_some_progress > 0, no_progress_loops)) > >>>- goto retry; > >>>- > >>>+ should_retry = should_reclaim_retry(gfp_mask, order, ac, alloc_flags, > >>>+ did_some_progress > 0, no_progress_loops); > >>> /* > >>> * It doesn't make any sense to retry for the compaction if the order-0 > >>> * reclaim is not able to make any progress because the current > >>> * implementation of the compaction depends on the sufficient amount > >>> * of free memory (see __compaction_suitable) > >>> */ > >>>- if (did_some_progress > 0 && > >>>- should_compact_retry(ac, order, alloc_flags, > >>>+ if (did_some_progress > 0) > >>>+ should_retry |= should_compact_retry(ac, order, alloc_flags, > >>> compact_result, &compact_priority, > >>>- compaction_retries)) > >>>+ compaction_retries); > >>>+ if (should_retry) > >>> goto retry; > >> > >>Hmm... it looks odd that we check should_compact_retry() when > >>did_some_progress > 0. If system is full of anonymous memory and we > >>don't have swap, we can't reclaim anything but we can compact. > > > >Right, thanks. > > Hmm on the other hand, should_compact_retry will assume (in > compaction_zonelist_suitable()) that reclaimable memory is actually > reclaimable. If there's nothing to tell us that it actually isn't, > if we drop the reclaim progress requirement. That's risking an > infinite loop? You are right. I hope this retry logic will be robust to cover all the theoretical situations but it looks not easy. Sigh... Thanks.