From patchwork Tue May 23 11:57:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13252123 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 0BC3FC7EE23 for ; Tue, 23 May 2023 11:40:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 52AF6900003; Tue, 23 May 2023 07:40:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4B3F2900002; Tue, 23 May 2023 07:40:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 35523900003; Tue, 23 May 2023 07:40:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 22D33900002 for ; Tue, 23 May 2023 07:40:53 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id E55448072A for ; Tue, 23 May 2023 11:40:52 +0000 (UTC) X-FDA: 80821327944.02.9BE434A Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf28.hostedemail.com (Postfix) with ESMTP id B09B3C0004 for ; Tue, 23 May 2023 11:40:48 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=none; spf=pass (imf28.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1684842050; h=from:from:sender:reply-to: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: references; bh=6q4IukDDin+ijMil6aqbySwUhPZP+jCmfIF64DQNFa4=; b=hL6Aris0YVnp2X9J4D10erSBy/DbI5qhgmwnvUlLfB5aT1AU/NZ6332DG3+I3kQIElNcZC ko+O86vXAibQ/XfadQP/d+R0Wgy1RyP0QzjuHL58z6ILL5kLD6RuTfOKEqhTZbfvAz22hC BFzcgjQYZ21fZL+PTiBeaGrl9cccvOY= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=none; spf=pass (imf28.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684842050; a=rsa-sha256; cv=none; b=Ac0UHFeQMX8F1emFKpvhoFKeGWrPlbyy3S5kme7NhqlUQiYRxLqWkmDDcWqs5REIXSW2vh C+379vDJ154SssJjHbt+n7pC6ruDqhUYLLy2ORaDzo8YD7rDe0EYPKvhq4DQVM21p2PFff AViDEll0ii24B10w6ocAUb8CzBZBQYk= Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4QQXMM3WqTzqSkZ; Tue, 23 May 2023 19:36:15 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Tue, 23 May 2023 19:40:43 +0800 From: Kefeng Wang To: Mike Rapoport , Andrew Morton , CC: , , , , Kefeng Wang Subject: [PATCH] memblock: update numa node of memblk reserved type Date: Tue, 23 May 2023 19:57:08 +0800 Message-ID: <20230523115708.195597-1-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 Reply-To: <20230519105321.333-1-ssawgyw@gmail.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: B09B3C0004 X-Rspam-User: X-Stat-Signature: ct77yow4sx63w6rmq3tf5eh8in9dqu3h X-Rspamd-Server: rspam01 X-HE-Tag: 1684842048-531219 X-HE-Meta: U2FsdGVkX1+7eXOR0HY0G61KVQr0KvBrgiPZU33LcJdhXXtzfY2iVS6AEAinovTWQ87agKWRhcUTfyAiSASku71jPBFZ7TfJaZheghM8vCFDdPZXT4SvIiMA5csSiz0F8cEB5/glwLjbh3TT0Xr821PiFMb08GZW4Pl61mzaR6n+WVDGk2wq8DCZzWbPshVGMwykpYwcA3ujbCs9XjUB+DS8Tdlwz4gIv4+a+tT8Fm/oY3lOkc+jlV7jg3o0NwkKldylwivhOi+WzjrcORA7aoh9vPtQ7iNIQbQhgOBmObP+0IzdodVLg/7L3k565SXZpdP3+EdiHdLXDG10yi3S0PzXfSOOsAnmQ7XokdXQQebUMBwUKN1yUyjS73UGAIQabW1DJwOgj7I3JmDOSoALPQElZ1i2rXkH9VmwweESA0xhH16lqoq9M1+17W2rP7VkHhXoXqnH15Yr2ytxcMLoL210Joheka0Edyv/05hYbdBwrolR3II2GVyBH1X62ME8+17390iCfFdyOMet9EnCmlxfNe9bU7iXW+S/kl+GF71Pz9JVCzqDpaKQ61djvamuJsvoLDJQwQhPBp0FEAzKQ4U9XDGIz1dWNKh1BBGJ1s8DEvtetr+CgZ4/JsCJ3UBFDZqlbQ3TPPKxEk+Q2Mr7ax1IMrIrKMC+4eZPVrBD97HK/sreG7BFZGs8eehZK6zaRGg9VPGHHcLbecYxXld9zOz7ijYjjFvqn8JPfwJ4JTc3JvFV5PHFj7WhOc6stc/Sd4Ewq7vbzUaLZKi+XztcJKKcoyms2B9bo2s64vsO/SHBIuMk3mh/5Cu+YEdgczY4kvymgXpziWkZ3sjYNhFA5tag/bBC+OpM8DvxdkpX2kIqRy23own1tRrw3LjlalGoLTKvadgVexfv/E1wQfvTlp2OGvUZWBXt39chgn3ewpi/Rv4VGWM3MxdH62t0tnrb58jLwU0wi303xOiEf+c jpchGmSF 3PFG6dKUsIPbN8lDh9B9/1m4B08qkS9TKF65Ek/gw6hiYJUHgYhp9b6RdAgNFkOGvCYvzEVxnd1NXNDpeDiCqXAFOEjuNCmk5oevlAoBYa7l7T4hZNXQjaU7nABJ6uUkEssMRiqyGdqIFlB9CUug8l/Pxke0EcgVngr/nhlzzqSSdKyIt7ff6fsVT/e/Xb/sXBb4zZCY4Ow1un2vgpvEj5xUFngB43Sk+p+4CJ4fvgMOXzEkbNE5P+Wq9FydqIvbv82xpzrI0sQD4C2gfMa/+nLvK/Ye51Dc2kZKWM7bCknVeRPCbvXUf7N/cVBYTvIdzai49+Hra0MsqSnjD92rKMCtwNJskrUpHfjQsFg+QIpyY18A= 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: The numa node of memblk reserved type is wrong, it could update according to the numa node information from memblk memory type, let's fix it. Signed-off-by: Kefeng Wang --- mm/memblock.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/mm/memblock.c b/mm/memblock.c index a50447d970ef..45a0781cda31 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -1922,6 +1922,28 @@ phys_addr_t __init_memblock memblock_get_current_limit(void) return memblock.current_limit; } +static void __init_memblock memblock_reserved_update_node(void) +{ + struct memblock_region *rgn; + phys_addr_t base, end, size; + int ret; + + if (!IS_ENABLED(CONFIG_NUMA)) + return; + + for_each_mem_region(rgn) { + base = rgn->base; + size = rgn->size; + end = base + size - 1; + + ret = memblock_set_node(base, size, &memblock.reserved, + memblock_get_region_node(rgn)); + if (ret) + pr_err("memblock: Failed to update reserved [%pa-%pa] node", + &base, &end); + } +} + static void __init_memblock memblock_dump(struct memblock_type *type) { phys_addr_t base, end, size; @@ -1955,6 +1977,7 @@ static void __init_memblock __memblock_dump_all(void) &memblock.memory.total_size, &memblock.reserved.total_size); + memblock_reserved_update_node(); memblock_dump(&memblock.memory); memblock_dump(&memblock.reserved); #ifdef CONFIG_HAVE_MEMBLOCK_PHYS_MAP @@ -2196,6 +2219,8 @@ static int memblock_debug_show(struct seq_file *m, void *private) unsigned int count = ARRAY_SIZE(flagname); phys_addr_t end; + memblock_reserved_update_node(); + for (i = 0; i < type->cnt; i++) { reg = &type->regions[i]; end = reg->base + reg->size - 1;