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 D5535C433EF for ; Thu, 12 May 2022 02:27:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 405BF6B0074; Wed, 11 May 2022 22:27:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3B4A66B0075; Wed, 11 May 2022 22:27:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 27BCD6B0078; Wed, 11 May 2022 22:27:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 182226B0074 for ; Wed, 11 May 2022 22:27:50 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id D0FF83155D for ; Thu, 12 May 2022 02:27:49 +0000 (UTC) X-FDA: 79455505458.06.FB55BF0 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf25.hostedemail.com (Postfix) with ESMTP id 33412A000E for ; Thu, 12 May 2022 02:27:30 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4KzFyc5y0Zz1JBxk; Thu, 12 May 2022 10:26:32 +0800 (CST) Received: from [10.174.177.76] (10.174.177.76) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 12 May 2022 10:27:45 +0800 Subject: Re: [PATCH] mm, compaction: fast_find_migrateblock() should return pfn in the target zone To: Rei Yamamoto CC: , , , , , , References: <07e0ceb8-a637-b011-bbf6-ba760a0b12e4@huawei.com> <20220512014736.16376-1-yamamoto.rei@jp.fujitsu.com> From: Miaohe Lin Message-ID: <4cf33f9c-89bc-f845-10d7-2aa62a20f5e5@huawei.com> Date: Thu, 12 May 2022 10:27:44 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <20220512014736.16376-1-yamamoto.rei@jp.fujitsu.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.76] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 33412A000E X-Stat-Signature: retqnsnajp665c76qwhxbjr1zs1u4i9r X-Rspam-User: Authentication-Results: imf25.hostedemail.com; dkim=none; spf=pass (imf25.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-HE-Tag: 1652322450-148204 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 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! > > Thanks, > Rei > . >