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,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 4E984C433E0 for ; Thu, 28 Jan 2021 14:23:04 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id ACFDA64DDB for ; Thu, 28 Jan 2021 14:23:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ACFDA64DDB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=techsingularity.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 17C5B6B006C; Thu, 28 Jan 2021 09:23:03 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 12D7D6B0070; Thu, 28 Jan 2021 09:23:03 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 042A16B0071; Thu, 28 Jan 2021 09:23:02 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0064.hostedemail.com [216.40.44.64]) by kanga.kvack.org (Postfix) with ESMTP id E2C576B006C for ; Thu, 28 Jan 2021 09:23:02 -0500 (EST) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id A07E3180AD82F for ; Thu, 28 Jan 2021 14:23:02 +0000 (UTC) X-FDA: 77755400604.02.train75_1f07b16275a0 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin02.hostedemail.com (Postfix) with ESMTP id 66B0D10097AA0 for ; Thu, 28 Jan 2021 14:23:02 +0000 (UTC) X-HE-Tag: train75_1f07b16275a0 X-Filterd-Recvd-Size: 2475 Received: from outbound-smtp27.blacknight.com (outbound-smtp27.blacknight.com [81.17.249.195]) by imf45.hostedemail.com (Postfix) with ESMTP for ; Thu, 28 Jan 2021 14:23:01 +0000 (UTC) Received: from mail.blacknight.com (pemlinmail02.blacknight.ie [81.17.254.11]) by outbound-smtp27.blacknight.com (Postfix) with ESMTPS id 25ED0CB04B for ; Thu, 28 Jan 2021 14:23:00 +0000 (GMT) Received: (qmail 27995 invoked from network); 28 Jan 2021 14:22:59 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.22.4]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 28 Jan 2021 14:22:59 -0000 Date: Thu, 28 Jan 2021 14:22:57 +0000 From: Mel Gorman To: Vlastimil Babka Cc: Wonhyuk Yang , Andrew Morton , linux-mm@kvack.org Subject: Re: [PATCH v2] mm/compactoin: Fix misbehaviors of fast_find_migrateblock() Message-ID: <20210128142257.GG3592@techsingularity.net> References: <20210128130411.6125-1-vvghjk1234@gmail.com> <20210128132508.GE3592@techsingularity.net> <095faeec-ecb1-77c8-6118-267d28710508@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <095faeec-ecb1-77c8-6118-267d28710508@suse.cz> User-Agent: Mutt/1.10.1 (2018-07-13) 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 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) 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. -- Mel Gorman SUSE Labs