From: Baoquan He <bhe@redhat.com>
To: Yuntao Wang <ytcoode@gmail.com>
Cc: alexander.shishkin@linux.intel.com, bp@alien8.de,
dave.hansen@linux.intel.com, hpa@zytor.com, jgross@suse.com,
linux-kernel@vger.kernel.org, mingo@redhat.com,
peterz@infradead.org, ssengar@linux.microsoft.com,
tglx@linutronix.de, x86@kernel.org,
Andy Lutomirski <luto@kernel.org>, Arnd Bergmann <arnd@arndb.de>
Subject: Re: [PATCH v2] x86/setup: Use a more concise memblock API
Date: Tue, 14 Nov 2023 16:36:53 +0800 [thread overview]
Message-ID: <ZVMxpXBrE4p3IqhU@MiWiFi-R3L-srv> (raw)
In-Reply-To: <20231114073700.126543-1-ytcoode@gmail.com>
On 11/14/23 at 03:37pm, Yuntao Wang wrote:
> When executing relocate_initrd()/numa_emulation()/numa_alloc_distance(),
> the memblock.current_limit field has already been set to
> `max_pfn_mapped << PAGE_SHIFT`, therefore we can replace
> memblock_phys_alloc_range() with memblock_phys_alloc(), which has the same
> functionality but is more concise.
>
> Signed-off-by: Yuntao Wang <ytcoode@gmail.com>
> ---
> v1 -> v2:
>
> Also replace memblock_phys_alloc_range() in numa_emulation() and
> numa_alloc_distance() with memblock_phys_alloc()
LGTM,
Reviewed-by: Baoquan He <bhe@redhat.com>
>
> arch/x86/kernel/setup.c | 3 +--
> arch/x86/mm/numa.c | 3 +--
> arch/x86/mm/numa_emulation.c | 3 +--
> 3 files changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
> index ec2c21a1844e..422497c17eec 100644
> --- a/arch/x86/kernel/setup.c
> +++ b/arch/x86/kernel/setup.c
> @@ -259,8 +259,7 @@ static void __init relocate_initrd(void)
> u64 area_size = PAGE_ALIGN(ramdisk_size);
>
> /* We need to move the initrd down into directly mapped mem */
> - u64 relocated_ramdisk = memblock_phys_alloc_range(area_size, PAGE_SIZE, 0,
> - PFN_PHYS(max_pfn_mapped));
> + u64 relocated_ramdisk = memblock_phys_alloc(area_size, PAGE_SIZE);
> if (!relocated_ramdisk)
> panic("Cannot find place for new RAMDISK of size %lld\n",
> ramdisk_size);
> diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
> index b29ceb19e46e..29cd8fc8ede1 100644
> --- a/arch/x86/mm/numa.c
> +++ b/arch/x86/mm/numa.c
> @@ -378,8 +378,7 @@ static int __init numa_alloc_distance(void)
> cnt++;
> size = cnt * cnt * sizeof(numa_distance[0]);
>
> - phys = memblock_phys_alloc_range(size, PAGE_SIZE, 0,
> - PFN_PHYS(max_pfn_mapped));
> + phys = memblock_phys_alloc(size, PAGE_SIZE);
> if (!phys) {
> pr_warn("Warning: can't allocate distance table!\n");
> /* don't retry until explicitly reset */
> diff --git a/arch/x86/mm/numa_emulation.c b/arch/x86/mm/numa_emulation.c
> index 9a9305367fdd..8acb8d0f7d0f 100644
> --- a/arch/x86/mm/numa_emulation.c
> +++ b/arch/x86/mm/numa_emulation.c
> @@ -447,8 +447,7 @@ void __init numa_emulation(struct numa_meminfo *numa_meminfo, int numa_dist_cnt)
> if (numa_dist_cnt) {
> u64 phys;
>
> - phys = memblock_phys_alloc_range(phys_size, PAGE_SIZE, 0,
> - PFN_PHYS(max_pfn_mapped));
> + phys = memblock_phys_alloc(phys_size, PAGE_SIZE);
> if (!phys) {
> pr_warn("NUMA: Warning: can't allocate copy of distance table, disabling emulation\n");
> goto no_emu;
> --
> 2.42.1
>
prev parent reply other threads:[~2023-11-14 8:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-14 3:14 [PATCH] x86/setup: Use a more concise memblock API Yuntao Wang
2023-11-14 4:11 ` Baoquan He
2023-11-14 7:37 ` [PATCH v2] " Yuntao Wang
2023-11-14 8:36 ` Baoquan He [this message]
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=ZVMxpXBrE4p3IqhU@MiWiFi-R3L-srv \
--to=bhe@redhat.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=arnd@arndb.de \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jgross@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=ssengar@linux.microsoft.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--cc=ytcoode@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.