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 D1D47C433E0 for ; Thu, 28 Jan 2021 14:01:50 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6835264DD8 for ; Thu, 28 Jan 2021 14:01:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6835264DD8 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 CFDE86B007E; Thu, 28 Jan 2021 09:01:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CADC56B0080; Thu, 28 Jan 2021 09:01:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C12216B0081; Thu, 28 Jan 2021 09:01:49 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0018.hostedemail.com [216.40.44.18]) by kanga.kvack.org (Postfix) with ESMTP id A9A496B007E for ; Thu, 28 Jan 2021 09:01:49 -0500 (EST) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 8B3563634 for ; Thu, 28 Jan 2021 14:01:48 +0000 (UTC) X-FDA: 77755347096.19.men45_54074b4275a0 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin19.hostedemail.com (Postfix) with ESMTP id 0DE2019299 for ; Thu, 28 Jan 2021 14:01:30 +0000 (UTC) X-HE-Tag: men45_54074b4275a0 X-Filterd-Recvd-Size: 1908 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf06.hostedemail.com (Postfix) with ESMTP for ; Thu, 28 Jan 2021 14:01:29 +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 524B6AD19; Thu, 28 Jan 2021 14:01:28 +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> From: Vlastimil Babka Message-ID: <095faeec-ecb1-77c8-6118-267d28710508@suse.cz> Date: Thu, 28 Jan 2021 15:01:27 +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 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)