public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/setup: Use a more concise memblock API
@ 2023-11-14  3:14 Yuntao Wang
  2023-11-14  4:11 ` Baoquan He
  0 siblings, 1 reply; 4+ messages in thread
From: Yuntao Wang @ 2023-11-14  3:14 UTC (permalink / raw)
  To: x86, linux-kernel
  Cc: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
	H. Peter Anvin, Peter Zijlstra (Intel), Juergen Gross, Baoquan He,
	Alexander Shishkin, Saurabh Sengar, Yuntao Wang

When executing relocate_initrd(), the memblock.current_limit field has
already been set to `max_pfn_mapped << PAGE_SHIFT`, so 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>
---
 arch/x86/kernel/setup.c | 3 +--
 1 file changed, 1 insertion(+), 2 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);
-- 
2.42.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-11-14  8:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox