From: Kefeng Wang <wangkefeng.wang@huawei.com>
To: Mike Rapoport <rppt@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>, <linux-mm@kvack.org>
Cc: <linux-kernel@vger.kernel.org>, <tsahu@linux.ibm.com>,
<anshuman.khandual@arm.com>, <ssawgyw@gmail.com>
Subject: Re: [PATCH v2] memblock: update numa node of memblk reserved type
Date: Thu, 25 May 2023 19:42:00 +0800 [thread overview]
Message-ID: <49933f51-a17e-8eef-7539-10759a6fa3e2@huawei.com> (raw)
In-Reply-To: <20230525115742.124190-1-wangkefeng.wang@huawei.com>
please ignore it, send wrong patch...
On 2023/5/25 19:57, Kefeng Wang wrote:
> The numa node of memblk reserved type is always wrong when check
> memblock_dump_all() or sysfs file (/sys/kernel/debug/memblock/reserved),
> no one use reserved type's node except the two debug interfaces,
> but uncorrect value is bad as the above interfaces are visible for
> user. Let's fix it according to the numa node information from memblk
> memory type by adding a memblock_reserved_update_node(), note, it will
> be called twice since memblock_reserve could still be called after
> memblock_dump_all(), or the sysfs file read may get some wrong value.
>
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
> v2:
> - update changelog, explain why update reserved node info twice
> - move memblock_reserved_update_node() from sysfs read into
> memblock_init_debugfs()
>
> mm/memblock.c | 24 ++++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
>
> diff --git a/mm/memblock.c b/mm/memblock.c
> index c5c80d9bcea3..50dd12958e60 100644
> --- a/mm/memblock.c
> +++ b/mm/memblock.c
> @@ -1899,6 +1899,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;
> @@ -1932,6 +1954,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
> @@ -2209,6 +2232,7 @@ static int __init memblock_init_debugfs(void)
> debugfs_create_file("physmem", 0444, root, &physmem,
> &memblock_debug_fops);
> #endif
> + memblock_reserved_update_node();
>
> return 0;
> }
next prev parent reply other threads:[~2023-05-25 11:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-25 11:57 [PATCH v2] memblock: update numa node of memblk reserved type Kefeng Wang
2023-05-25 11:42 ` Kefeng Wang [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-05-24 11:09 Kefeng Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49933f51-a17e-8eef-7539-10759a6fa3e2@huawei.com \
--to=wangkefeng.wang@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=anshuman.khandual@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rppt@kernel.org \
--cc=ssawgyw@gmail.com \
--cc=tsahu@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).