Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp299240iob; Fri, 13 May 2022 01:53:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzkZ+MYdeG+272fQ0B80TJ05cgahoiYn7SADcCr9H3ulFgZJBRBFw2n5JJX3eZa82j1oac9 X-Received: by 2002:a17:902:a516:b0:15f:309f:7805 with SMTP id s22-20020a170902a51600b0015f309f7805mr3892341plq.114.1652432036136; Fri, 13 May 2022 01:53:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652432036; cv=none; d=google.com; s=arc-20160816; b=obNQfrjt/Gjo7+lx3dJCHJCNR6GjJ0P+n8GIVmsCR9+6rOmvKNR+UCCZK5MQ9PoHcB HYWLrXXQKQUd98YOHBOoWA/ABt/h+VbzuaMUYCrmPDYzRfOD7GGM8D13wsUqzFux/88X c9CPa+7EXAfVP3w9u0OpC3nJ9OautUDkz4GFm656Ul+fJPPPAPBYUafmyB3c9Byt6SGS rNNeEumYSql7OdRFBPxzCHZZ8CpUV5Q+zuSWig/GArPlozInWkx2kpsB43BoEjQ5F8e9 /QTlaC0PWnubzNPVFoXPaC8Lg97LlvtU+UefyBHooDJ9vef/X4ioSFveYiIQeVVShkSC zJNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=c2Zv+vwNmZ1xklnBhOLAtOpCI+EMgOqiENN1aVOad9I=; b=jffp7eOx8G9GiVLDrOiE93cNLd5s5CkOckMXSM2fLKGwCYaIfyROnjEp8PvrDH/OUH BXUeWmaig20kUqqx/8nr9hwuuXWkG3KQLLeQXdp0H6Uw0arzbTZvwLqV2NrcGHcfdFs+ rp2tg9D7wVi08RLOvAFZih72/T4I6ek2B84JqSl01FhC4ZoG+GcmRTzFwNvv/uxZFSQ6 bYWQRV8np9tjQCGSdjYjYxk5BoeidzYpBsyHxXD1X/+7fSuJfmRajvem9fIcF+hQ6N6y L24QFp61Z8yXX6O75N78v2vBgFGLRaqLItt2sxRJ06U9WSpVL8jVIFETzjaE9qG60JQW BksQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=fujitsu.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nu6-20020a17090b1b0600b001d94259f3dfsi6770253pjb.95.2022.05.13.01.53.44; Fri, 13 May 2022 01:53:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=fujitsu.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237601AbiELCIU (ORCPT + 99 others); Wed, 11 May 2022 22:08:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237383AbiELCIR (ORCPT ); Wed, 11 May 2022 22:08:17 -0400 Received: from esa4.hc1455-7.c3s2.iphmx.com (esa4.hc1455-7.c3s2.iphmx.com [68.232.139.117]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A80846D85E for ; Wed, 11 May 2022 19:08:15 -0700 (PDT) X-IronPort-AV: E=McAfee;i="6400,9594,10344"; a="72336034" X-IronPort-AV: E=Sophos;i="5.91,218,1647270000"; d="scan'208";a="72336034" Received: from unknown (HELO yto-r4.gw.nic.fujitsu.com) ([218.44.52.220]) by esa4.hc1455-7.c3s2.iphmx.com with ESMTP; 12 May 2022 11:08:13 +0900 Received: from yto-m2.gw.nic.fujitsu.com (yto-nat-yto-m2.gw.nic.fujitsu.com [192.168.83.65]) by yto-r4.gw.nic.fujitsu.com (Postfix) with ESMTP id 7B5E0D3EB0 for ; Thu, 12 May 2022 11:08:12 +0900 (JST) Received: from m3002.s.css.fujitsu.com (msm3.b.css.fujitsu.com [10.128.233.104]) by yto-m2.gw.nic.fujitsu.com (Postfix) with ESMTP id AF517F28A1 for ; Thu, 12 May 2022 11:08:11 +0900 (JST) Received: from localhost.localdomain (unknown [10.125.5.220]) by m3002.s.css.fujitsu.com (Postfix) with ESMTP id 7629E200B383; Thu, 12 May 2022 11:08:11 +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 10:47:36 +0900 Message-Id: <20220512014736.16376-1-yamamoto.rei@jp.fujitsu.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <07e0ceb8-a637-b011-bbf6-ba760a0b12e4@huawei.com> References: <07e0ceb8-a637-b011-bbf6-ba760a0b12e4@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Thanks, Rei