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 39E13C83F34 for ; Fri, 18 Jul 2025 01:37:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 998BD6B007B; Thu, 17 Jul 2025 21:37:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 923476B0088; Thu, 17 Jul 2025 21:37:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7E9AE6B0089; Thu, 17 Jul 2025 21:37:57 -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 6ADC96B007B for ; Thu, 17 Jul 2025 21:37:57 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id D365880286 for ; Fri, 18 Jul 2025 01:37:56 +0000 (UTC) X-FDA: 83675674152.12.A2D06FF Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf28.hostedemail.com (Postfix) with ESMTP id E6D28C0004 for ; Fri, 18 Jul 2025 01:37:53 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf28.hostedemail.com: domain of mawupeng1@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=mawupeng1@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1752802675; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=L8ZKcP9qyenLTtip3H8MZ/suZBQdk6I8oNnojOhY5Jo=; b=UMf8hQp9y3BUcm7h8muUmK2HVBY9FLsFXdJWsyD+Sl1AFsIveHHmlBSPB6Vw/C8HiLggTB 2YwwR/60ngOtAj68Lhts8UiXOPbKh7Bpak19Cz6V9nN0IVKb//K/oLI5u+AwrzwReFBeX3 JeXKUddHfTtXjE/u5QWZgKoOIw0T560= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1752802675; a=rsa-sha256; cv=none; b=6Der4usIgJG5GtjeDEMi0HaoW9g7fY2xMsaFttXqaFrzt9gyUtUlqCqWIWR20ASz8Ez9GJ wo1AhdoyTw6QhuCgg5WwvhUz5ARa6qvG3woFK3ejtu957sEFr+Ndi8v+EsJGH1zfnxe1eR dg+PBKxhM5Ibb6dB1MlOYbyQ6rwhutg= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf28.hostedemail.com: domain of mawupeng1@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=mawupeng1@huawei.com Received: from mail.maildlp.com (unknown [172.19.162.254]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4bjspN3JfqztSbx; Fri, 18 Jul 2025 09:36:44 +0800 (CST) Received: from kwepemg100017.china.huawei.com (unknown [7.202.181.58]) by mail.maildlp.com (Postfix) with ESMTPS id 6A62C180486; Fri, 18 Jul 2025 09:37:49 +0800 (CST) Received: from [10.174.178.114] (10.174.178.114) by kwepemg100017.china.huawei.com (7.202.181.58) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 18 Jul 2025 09:37:48 +0800 Message-ID: <8d604308-36d3-4b55-8ddb-b33f8b586c1a@huawei.com> Date: Fri, 18 Jul 2025 09:37:48 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird CC: , , , , Subject: Re: [PATCH] mm: ignore nomap memory during mirror init To: References: <20250717085723.1875462-1-mawupeng1@huawei.com> <9688e968-e9af-4143-b550-16c02a0b4ceb@huawei.com> From: mawupeng In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.178.114] X-ClientProxiedBy: kwepems500002.china.huawei.com (7.221.188.17) To kwepemg100017.china.huawei.com (7.202.181.58) X-Rspamd-Queue-Id: E6D28C0004 X-Stat-Signature: r5gyk8hap1439sytaosqyy569tdftmus X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1752802673-613779 X-HE-Meta: U2FsdGVkX1+5vFyA/Q3XY2J2JnWfbCjBux5NtMJolqYXNrt8M3inmufHSbH9aZMmTQflj58Pxorx31zfzG4q70ptWjndatDlhme7nPNelwGi33rtR/aU9bQFu4yXG1wMBmxXRKUvml/j8AZ7nYCfXUUuvegWA6H4dMXkyvVxVtSEEEyONgxvbRdHK+0oc7fYr5XGMrlMYdGFm6B9PqAa1HX/UXdpBzoIv5kb3azNOfZWhxTg6vq8Djx3lQVwl1OZWJ/0OyE3t/IHQb5eXHSSay9xLPm9mRLKkp5vnpTGeE7VSYupA70GKmiN4UKezrANCmFU3/hHSHnLowCM/6Rk10re0+UjsLOX8aKizUkheExO4YA0O4TPbjuU/td9bX6RlgpIHXjf5OjVYSvqsBuDL6wl74/unaYtG00E2AE9emO5Mx8wZWJX0aR1fHDZE6olA0KgGW3HEiqNpfzqHdfz79TzzqsoRqjam/5R3TNnCdPwV9BPj7N/nYK5J3bKyg+W7ap0i2mOd2lHQR/OoreJ7DJWnSfcPjHVKX2SqY7yAZ80H2Hf0vSh3zRlJvbB/qsX0AgKj4L6DjBQ3h0M0ZIDQOZqka6gMuMK8ooiapIm9VOPZFmMk3D1XeA4sYipsEsloV8KCufhbT5WNqMLyJBPXte8D5AqSyjzaofhRZSBeqwGuW2kTBZBQhIPyXJ9GyRA0K9NIdce49yeKIarEeXZJJwMbe52NhfdI4EkdTTi5S4j1mPolNOeokV1oMeaHcghzGhokqMg0xnc196VEapdRyWoL2dhA4b55Bd6HdxHwHWz+ZFAM2RHY+dKi60vQToxyhRzDa6snSwWsN7pKspOnA98+TO0KEzpTItSgHZvutzrcCnJMwEgir0PZkKGvfK+7kdITG78/mc45+WAsX6KbQG/vJb0kGiyi2Hs8Bn/jhc9eOJkh6uTXsEOHVzYkxLEQEc5RuVjlZwDpzUzGZa jbprvv9g rbwJ5e9bHWanWdAM8QurynVgW9BlHMsEaEpbUpHXTv2fCouDzWgKoIfusRyyHD4zDVs+tPBIdqlMG7DQzK9qfYjYTt2CjNrMBSwHWxMme5bJlJx+cIzlSzJ0DXOwL1Efpl07anNUajjipUqTCz42GwiQSiuSbNenm4ye5tXYZRjjSp3QkDy2Rz9/zjbL8kyVwafIDGPRk3lzCQlqI77oq0acxwBFjHvnqIt9muNcw8mg6BQk= 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: List-Subscribe: List-Unsubscribe: On 2025/7/17 21:37, Mike Rapoport wrote: > On Thu, Jul 17, 2025 at 07:06:52PM +0800, mawupeng wrote: >> >> On 2025/7/17 18:29, Mike Rapoport wrote: >>> On Thu, Jul 17, 2025 at 04:57:23PM +0800, Wupeng Ma wrote: >>>> When memory mirroring is enabled, the BIOS may reserve memory regions >>>> at the start of the physical address space without the MR flag. This will >>>> lead to zone_movable_pfn to be updated to the start of these reserved >>>> regions, resulting in subsequent mirrored memory being ignored. >>>> >>>> Here is the log with efi=debug enabled: >>>> efi: 0x084004000000-0x0842bf37ffff [Conventional| | |MR|...|WB|WT|WC| ] >>>> efi: 0x0842bf380000-0x0842c21effff [Loader Code | | |MR|...|WB|WT|WC| ] >>>> efi: 0x0842c21f0000-0x0847ffffffff [Conventional| | |MR|...|WB|WT|WC| ] >>>> efi: 0x085000000000-0x085fffffffff [Conventional| | | |...|WB|WT|WC| ] >>>> ... >>>> efi: 0x084000000000-0x084003ffffff [Reserved | | | |...|WB|WT|WC| ] >>>> >>>> Since this kind of memory can not be used by kernel. ignore nomap memory to fix >>>> this issue. >> >> Since the first non-mirror pfn of this node is 0x084000000000, then zone_movable_pfn >> for this node will be updated to this. This will lead to Mirror Region >> - 0x084004000000-0x0842bf37ffff >> - 0x0842bf380000-0x0842c21effff >> - 0x0842c21f0000-0x0847ffffffff >> be seen as non-mirror memory since zone_movable_pfn will be the start_pfn of this node >> in adjust_zone_range_for_zone_movable(). > > What do you mean by "seen as non-mirror memory"? It mean these memory range will be add to movable zone. > > What is the problem with having movable zone on that node start at > 0x084000000000? > > Can you post the kernel log up to "Memory: nK/mK available" line for more > context? Memory: nK/mK available can not see be problem here, since there is nothing wrong with the total memory. However this problem can be shown via lsmem --output-all w/o this patch [root@localhost ~]# lsmem --output-all RANGE SIZE STATE REMOVABLE BLOCK NODE ZONES 0x0000084000000000-0x00000847ffffffff 32G online yes 67584-67839 0 Movable 0x0000085000000000-0x0000085fffffffff 64G online yes 68096-68607 0 Movable w/ this patch [root@localhost ~]# lsmem --output-all RANGE SIZE STATE REMOVABLE BLOCK NODE ZONES 0x0000084000000000-0x00000847ffffffff 32G online yes 8448-8479 0 Normal 0x0000085000000000-0x0000085fffffffff 64G online yes 8512-8575 0 Movable As shown above, All memory in this node is added to Zone Movable even some range of the memory is mirror memory. With this patch, 0x0000084000000000-0x00000847ffffffff will be added to zone normal as expected since the MR attribute. > >> So igore nomap memory to fix this problem. >> >>> >>> If the memory is nomap it won't be used by the kernel anyway. >>> What's the actual issue you are trying to fix? >>> >>>> Signed-off-by: Wupeng Ma >>>> --- >>>> mm/mm_init.c | 2 +- >>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>> >>>> diff --git a/mm/mm_init.c b/mm/mm_init.c >>>> index f2944748f526..1c36518f0fe4 100644 >>>> --- a/mm/mm_init.c >>>> +++ b/mm/mm_init.c >>>> @@ -405,7 +405,7 @@ static void __init find_zone_movable_pfns_for_nodes(void) >>>> } >>>> >>>> for_each_mem_region(r) { >>>> - if (memblock_is_mirror(r)) >>>> + if (memblock_is_mirror(r) || memblock_is_nomap(r)) >>>> continue; >>>> >>>> nid = memblock_get_region_node(r); >>>> -- >>>> 2.43.0 >>>> >>> >> >