From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42101C433DB for ; Thu, 28 Jan 2021 14:40:38 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9676D64DE0 for ; Thu, 28 Jan 2021 14:40:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9676D64DE0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 0B1256B0005; Thu, 28 Jan 2021 09:40:37 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 061D36B0078; Thu, 28 Jan 2021 09:40:37 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E954F6B007B; Thu, 28 Jan 2021 09:40:36 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0201.hostedemail.com [216.40.44.201]) by kanga.kvack.org (Postfix) with ESMTP id D10FE6B0005 for ; Thu, 28 Jan 2021 09:40:36 -0500 (EST) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 8FC6B180AD820 for ; Thu, 28 Jan 2021 14:40:36 +0000 (UTC) X-FDA: 77755444872.15.cloth65_47135bf275a0 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin15.hostedemail.com (Postfix) with ESMTP id 5D8801814B0C8 for ; Thu, 28 Jan 2021 14:40:36 +0000 (UTC) X-HE-Tag: cloth65_47135bf275a0 X-Filterd-Recvd-Size: 2790 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Thu, 28 Jan 2021 14:40:35 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 94BA0ACB7; Thu, 28 Jan 2021 14:40:34 +0000 (UTC) Subject: Re: [PATCH v2] mm/compactoin: Fix misbehaviors of fast_find_migrateblock() To: Wonhyuk Yang , Mel Gorman Cc: Andrew Morton , linux-mm@kvack.org References: <20210128130411.6125-1-vvghjk1234@gmail.com> <20210128132508.GE3592@techsingularity.net> <095faeec-ecb1-77c8-6118-267d28710508@suse.cz> <20210128142257.GG3592@techsingularity.net> From: Vlastimil Babka Message-ID: Date: Thu, 28 Jan 2021 15:40:34 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 1/28/21 3:31 PM, Wonhyuk Yang wrote: > On Thu, Jan 28, 2021 at 11:23 PM Mel Gorman wrote: >> >> On Thu, Jan 28, 2021 at 03:01:27PM +0100, Vlastimil Babka wrote: >> > On 1/28/21 2:50 PM, Wonhyuk Yang wrote: >> > > On Thu, Jan 28, 2021 at 10:25 PM Mel Gorman wrote: >> > >> >> > >> As nr_scanned is post-incremented, this will still consider if the page >> > >> should be used when the limit is reached. ++nr_scanned? >> > > >> > > Hi, >> > > >> > > Let's consider that limit is 4, nr_scanned is 0 and loop until reach the limit. >> > > 1) pre-increment: it will search three times.(0,1,2) >> > > 2) post-increment: it will search four times. (0,1,2,3) >> > > >> > > So you mean that searching three times is correct? >> > >> > 1) will match the outer loop's "nr_scanned < limit;" condition. It doesn't >> > matter that much in practice, but for consistency sake, it should be 1) Got confused there, it's 2) that matches the outer loop condition, so your patch is fine. >> Ok, while I find it a little strange to enter the loop and then break >> immediately due to the limit, it's a marginal difference and in general, >> the patch makes sense. >> > > Then, should I change post-increment to pre-increment? IMHO, nope. > If so, should I send a new version? It seems like it's too tiny change...