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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB95DC433FE for ; Thu, 12 May 2022 04:48:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0D6BB6B0074; Thu, 12 May 2022 00:48:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 035616B0078; Thu, 12 May 2022 00:48:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C1C276B0074; Thu, 12 May 2022 00:48:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id AE09D6B0075 for ; Thu, 12 May 2022 00:48:14 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 852E860D60 for ; Thu, 12 May 2022 04:48:14 +0000 (UTC) X-FDA: 79455859308.07.985BEFA Received: from esa1.hc1455-7.c3s2.iphmx.com (esa1.hc1455-7.c3s2.iphmx.com [207.54.90.47]) by imf18.hostedemail.com (Postfix) with ESMTP id 893CF1C00A2 for ; Thu, 12 May 2022 04:48:02 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6400,9594,10344"; a="72588108" X-IronPort-AV: E=Sophos;i="5.91,218,1647270000"; d="scan'208";a="72588108" Received: from unknown (HELO oym-r1.gw.nic.fujitsu.com) ([210.162.30.89]) by esa1.hc1455-7.c3s2.iphmx.com with ESMTP; 12 May 2022 13:48:12 +0900 Received: from oym-m2.gw.nic.fujitsu.com (oym-nat-oym-m2.gw.nic.fujitsu.com [192.168.87.59]) by oym-r1.gw.nic.fujitsu.com (Postfix) with ESMTP id 84037ED55F for ; Thu, 12 May 2022 13:48:10 +0900 (JST) Received: from m3003.s.css.fujitsu.com (m3003.s.css.fujitsu.com [10.128.233.114]) by oym-m2.gw.nic.fujitsu.com (Postfix) with ESMTP id AAA47BDC75 for ; Thu, 12 May 2022 13:48:09 +0900 (JST) Received: from localhost.localdomain (unknown [10.125.5.220]) by m3003.s.css.fujitsu.com (Postfix) with ESMTP id 65FDB203EF3D; Thu, 12 May 2022 13:48:09 +0900 (JST) From: Rei Yamamoto To: linmiaohe@huawei.com Cc: akpm@linux-foundation.org, aquini@redhat.com, ddutile@redhat.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, mgorman@techsingularity.net, vvghjk1234@gmail.com, yamamoto.rei@jp.fujitsu.com Subject: Re: [PATCH] mm, compaction: fast_find_migrateblock() should return pfn in the target zone Date: Thu, 12 May 2022 13:27:33 +0900 Message-Id: <20220512042733.17976-1-yamamoto.rei@jp.fujitsu.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <4cf33f9c-89bc-f845-10d7-2aa62a20f5e5@huawei.com> References: <4cf33f9c-89bc-f845-10d7-2aa62a20f5e5@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 893CF1C00A2 Authentication-Results: imf18.hostedemail.com; dkim=none; spf=pass (imf18.hostedemail.com: domain of yamamoto.rei@jp.fujitsu.com designates 207.54.90.47 as permitted sender) smtp.mailfrom=yamamoto.rei@jp.fujitsu.com; dmarc=pass (policy=none) header.from=fujitsu.com X-Rspam-User: X-Stat-Signature: y1mqj4sk76qhyrbs168ydzy36uz7339c X-HE-Tag: 1652330882-331630 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, 12 May 2022 10:27:44 +0800 Miaohe Lin wrote: > On 2022/5/12 9:47, Rei Yamamoto wrote: >> On Wed, 11 May 2022 17:26:16 Miaohe Lin wrote: >>> On 2022/5/11 15:07, Rei Yamamoto wrote: >>>> On Wed, 11 May 2022 14:25:34 Miaohe Lin wrote: >>>>> On 2022/5/11 12:43, Rei Yamamoto wrote: >>>>>> Prevent returning a pfn outside the target zone in case that not >>>>>> aligned with pageblock boundary. >>>>>> Otherwise isolate_migratepages_block() would handle pages not in >>>>>> the target zone. >>>>>> >>>>> >>>>> IIUC, the sole caller isolate_migratepages will ensure the pfn won't outside >>>>> the target zone. So the below code change might not be necessary. Or am I miss >>>>> something ? >>>> >>>> While block_start_pfn is ensured, this variable is not used as the argument for >>>> isolate_migratepages_block(): >>>> ----- >>>> static isolate_migrate_t isolate_migratepages(struct compact_control *cc) >>>> { >>>> : >>>> low_pfn = fast_find_migrateblock(cc); >>>> block_start_pfn = pageblock_start_pfn(low_pfn); >>>> if (block_start_pfn < cc->zone->zone_start_pfn) >>>> block_start_pfn = cc->zone->zone_start_pfn; <--- block_start_pfn is ensured not outside >>>> the target zone >>>> : >>>> block_end_pfn = pageblock_end_pfn(low_pfn); >>>> : >>>> for (; block_end_pfn <= cc->free_pfn; >>>> fast_find_block = false, >>>> cc->migrate_pfn = low_pfn = block_end_pfn, >>>> block_start_pfn = block_end_pfn, >>>> block_end_pfn += pageblock_nr_pages) { >>>> : >>>> if (isolate_migratepages_block(cc, low_pfn, block_end_pfn, <--- low_pfn is passed as >>>> the argument >>> >>> Sorry, I think you're right. And could you please add the runtime effect of this issue? >>> >>> Anyway, this patch looks good to me now. Thanks! >> >> Thank you for your review. >> The runtime effect is that compaction become unintended behavior. >> For example, pages not in the target zone are added to cc->migratepages list in isolate_migratepages_block(). >> As a result, pages migrate between nodes unintentionally. > > Many thanks for clarifying. :) Is this worth a Fixes tag or even CC stable? > > Thanks! Thank you for your reply. If add a Fixes tag, I think the following commit: Fixes: 70b4459 ("mm, compaction: use free lists to quickly locate a migration source") Andrew, how do you think about this? Thanks, Rei