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=-11.9 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham 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 CB376C433F5 for ; Wed, 15 Sep 2021 06:26:21 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 48A4D61179 for ; Wed, 15 Sep 2021 06:26:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 48A4D61179 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 897D5900002; Wed, 15 Sep 2021 02:26:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 848556B0072; Wed, 15 Sep 2021 02:26:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7373B900002; Wed, 15 Sep 2021 02:26:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0185.hostedemail.com [216.40.44.185]) by kanga.kvack.org (Postfix) with ESMTP id 5FD096B0071 for ; Wed, 15 Sep 2021 02:26:20 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 03F7118239AD8 for ; Wed, 15 Sep 2021 06:26:19 +0000 (UTC) X-FDA: 78588823320.02.AE07BBB Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf01.hostedemail.com (Postfix) with ESMTP id 822335059EBC for ; Wed, 15 Sep 2021 06:26:19 +0000 (UTC) Received: from dggeme703-chm.china.huawei.com (unknown [172.30.72.53]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4H8VZM71Xyz1DGxX; Wed, 15 Sep 2021 14:25:15 +0800 (CST) Received: from [10.174.177.76] (10.174.177.76) by dggeme703-chm.china.huawei.com (10.1.199.99) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.8; Wed, 15 Sep 2021 14:26:15 +0800 Subject: Re: [PATCH v3] mm/page_isolation: fix potential missing call to unset_migratetype_isolate() To: David Hildenbrand , CC: , , , References: <20210914114348.15569-1-linmiaohe@huawei.com> <454bd51f-d7ee-6304-af23-7c95874f8890@redhat.com> From: Miaohe Lin Message-ID: <660c452e-521b-a5de-1170-0327421e181e@huawei.com> Date: Wed, 15 Sep 2021 14:26:15 +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: <454bd51f-d7ee-6304-af23-7c95874f8890@redhat.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: dggems702-chm.china.huawei.com (10.3.19.179) To dggeme703-chm.china.huawei.com (10.1.199.99) X-CFilter-Loop: Reflected X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 822335059EBC Authentication-Results: imf01.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=huawei.com; spf=pass (imf01.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com X-Stat-Signature: hkwe998ise447g9udhwjbi3jsout7d5b X-HE-Tag: 1631687179-241827 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 2021/9/15 2:13, David Hildenbrand wrote: > On 14.09.21 13:43, Miaohe Lin wrote: >> In start_isolate_page_range() undo path, pfn_to_online_page() just checks >> the first pfn in a pageblock while __first_valid_page() will traverse the >> pageblock until the first online pfn is found. So we may miss the call to >> unset_migratetype_isolate() in undo path and pages will remain isolated >> unexpectedly. Fix this by calling undo_isolate_page_range() and this will >> also help to simplify the code further. Note we shouldn't ever trigger it >> because MAX_ORDER-1 aligned pfn ranges shouldn't contain memory holes now. >> >> Fixes: 2ce13640b3f4 ("mm: __first_valid_page skip over offline pages") >> Signed-off-by: Miaohe Lin > > I read Michals reply, however, I am quite conservative with Fixes: tags. If there is nothing to fix, there is no BUG and the patch consequently merely a cleanup. > > I'd have gone with a patch description/subject as follows: > > " > mm/page_isolation: cleanup start_isolate_page_range() > > We can heavily simplify the code by reusing undo_isolate_page_range(). > > Note that this also tackles a theoretical issue that would have been a real BUG before commit c5e79ef561b0 ("mm/memory_hotplug.c: don't allow to online/offline memory blocks with holes"). In start_isolate_page_range() undo path, pfn_to_online_page() just checks > the first pfn in a pageblock while __first_valid_page() will traverse the pageblock until the first online pfn is found. So we may miss the call to unset_migratetype_isolate() in undo path and pages will remain isolated unexpectedly. > > Nowadays, start_isolate_page_range() never gets called on ranges that might contain memory holes. Consequently, this patch is not a fix but a cleanup. > " > > Anyhow, whatever the other people prefer, no strong opinion. I have no preference too. But if this is preferred, I will do it. > > Reviewed-by: David Hildenbrand Many thanks! :) >