linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [Patch v3 1/3] mm/mm_init.c: use memblock_region_memory_base_pfn() to get startpfn
@ 2024-05-25  2:30 Wei Yang
  2024-05-25  2:30 ` [Patch v3 2/3] mm/memblock: fix a typo of for_each_mem_region() Wei Yang
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Wei Yang @ 2024-05-25  2:30 UTC (permalink / raw)
  To: rppt, akpm; +Cc: linux-mm, Wei Yang

Just like what it does in "if (mirrored_kernelcore)", we should use
memblock_region_memory_base_pfn() to get the startpfn.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
---
v3: separate a typo fix to a new patch
---
 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 f72b852bd5b8..2dfb87841fdb 100644
--- a/mm/mm_init.c
+++ b/mm/mm_init.c
@@ -363,7 +363,7 @@ static void __init find_zone_movable_pfns_for_nodes(void)
 
 			nid = memblock_get_region_node(r);
 
-			usable_startpfn = PFN_DOWN(r->base);
+			usable_startpfn = memblock_region_memory_base_pfn(r);
 			zone_movable_pfn[nid] = zone_movable_pfn[nid] ?
 				min(usable_startpfn, zone_movable_pfn[nid]) :
 				usable_startpfn;
-- 
2.34.1



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

* [Patch v3 2/3] mm/memblock: fix a typo of for_each_mem_region()
  2024-05-25  2:30 [Patch v3 1/3] mm/mm_init.c: use memblock_region_memory_base_pfn() to get startpfn Wei Yang
@ 2024-05-25  2:30 ` Wei Yang
  2024-05-25  2:30 ` [Patch v3 3/3] mm/mm_init.c: move nr_initialised reset down a bit Wei Yang
  2024-05-25 15:36 ` [Patch v3 1/3] mm/mm_init.c: use memblock_region_memory_base_pfn() to get startpfn Mike Rapoport
  2 siblings, 0 replies; 4+ messages in thread
From: Wei Yang @ 2024-05-25  2:30 UTC (permalink / raw)
  To: rppt, akpm; +Cc: linux-mm, Wei Yang

No functional change.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
---
 include/linux/memblock.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index e2082240586d..6cf18dc2b4d0 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -565,7 +565,7 @@ static inline unsigned long memblock_region_reserved_end_pfn(const struct memblo
 }
 
 /**
- * for_each_mem_region - itereate over memory regions
+ * for_each_mem_region - iterate over memory regions
  * @region: loop variable
  */
 #define for_each_mem_region(region)					\
-- 
2.34.1



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

* [Patch v3 3/3] mm/mm_init.c: move nr_initialised reset down a bit
  2024-05-25  2:30 [Patch v3 1/3] mm/mm_init.c: use memblock_region_memory_base_pfn() to get startpfn Wei Yang
  2024-05-25  2:30 ` [Patch v3 2/3] mm/memblock: fix a typo of for_each_mem_region() Wei Yang
@ 2024-05-25  2:30 ` Wei Yang
  2024-05-25 15:36 ` [Patch v3 1/3] mm/mm_init.c: use memblock_region_memory_base_pfn() to get startpfn Mike Rapoport
  2 siblings, 0 replies; 4+ messages in thread
From: Wei Yang @ 2024-05-25  2:30 UTC (permalink / raw)
  To: rppt, akpm; +Cc: linux-mm, Wei Yang

We don't need to count nr_initialised in two cases:

* for low zones we always populate it
* after first_deferred_pfn is detected

Let's move the nr_initialised reset down a bit to reduce some comparison
of prev_end_pfn and end_pfn.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>

---
v2: move it after first_deferred_pfn is detected per rppt's comment
---
 mm/mm_init.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/mm/mm_init.c b/mm/mm_init.c
index 2dfb87841fdb..bdbd800b0436 100644
--- a/mm/mm_init.c
+++ b/mm/mm_init.c
@@ -676,6 +676,14 @@ defer_init(int nid, unsigned long pfn, unsigned long end_pfn)
 
 	if (early_page_ext_enabled())
 		return false;
+
+	/* Always populate low zones for address-constrained allocations */
+	if (end_pfn < pgdat_end_pfn(NODE_DATA(nid)))
+		return false;
+
+	if (NODE_DATA(nid)->first_deferred_pfn != ULONG_MAX)
+		return true;
+
 	/*
 	 * prev_end_pfn static that contains the end of previous zone
 	 * No need to protect because called very early in boot before smp_init.
@@ -685,12 +693,6 @@ defer_init(int nid, unsigned long pfn, unsigned long end_pfn)
 		nr_initialised = 0;
 	}
 
-	/* Always populate low zones for address-constrained allocations */
-	if (end_pfn < pgdat_end_pfn(NODE_DATA(nid)))
-		return false;
-
-	if (NODE_DATA(nid)->first_deferred_pfn != ULONG_MAX)
-		return true;
 	/*
 	 * We start only with one section of pages, more pages are added as
 	 * needed until the rest of deferred pages are initialized.
-- 
2.34.1



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

* Re: [Patch v3 1/3] mm/mm_init.c: use memblock_region_memory_base_pfn() to get startpfn
  2024-05-25  2:30 [Patch v3 1/3] mm/mm_init.c: use memblock_region_memory_base_pfn() to get startpfn Wei Yang
  2024-05-25  2:30 ` [Patch v3 2/3] mm/memblock: fix a typo of for_each_mem_region() Wei Yang
  2024-05-25  2:30 ` [Patch v3 3/3] mm/mm_init.c: move nr_initialised reset down a bit Wei Yang
@ 2024-05-25 15:36 ` Mike Rapoport
  2 siblings, 0 replies; 4+ messages in thread
From: Mike Rapoport @ 2024-05-25 15:36 UTC (permalink / raw)
  To: akpm, Wei Yang; +Cc: Mike Rapoport, linux-mm

From: Mike Rapoport (IBM) <rppt@kernel.org>

On Sat, 25 May 2024 02:30:38 +0000, Wei Yang wrote:
> Just like what it does in "if (mirrored_kernelcore)", we should use
> memblock_region_memory_base_pfn() to get the startpfn.
> 
> 

Applied to for-6.11 branch of memblock.git tree, thanks!

[1/3] mm/mm_init.c: use memblock_region_memory_base_pfn() to get startpfn
      commit: 560132fe1f5949ab324a54d3ce81997a8d2b5c41
[2/3] mm/memblock: fix a typo of for_each_mem_region()
      commit: 1e02f896e0ed8b8683687ba94203b3420c48bf80
[3/3] mm/mm_init.c: move nr_initialised reset down a bit
      commit: 8c73b8ee064679d0d67e393e4a680784f886a94c

tree: https://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock
branch: for-6.11

--
Sincerely yours,
Mike.



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

end of thread, other threads:[~2024-05-25 15:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-25  2:30 [Patch v3 1/3] mm/mm_init.c: use memblock_region_memory_base_pfn() to get startpfn Wei Yang
2024-05-25  2:30 ` [Patch v3 2/3] mm/memblock: fix a typo of for_each_mem_region() Wei Yang
2024-05-25  2:30 ` [Patch v3 3/3] mm/mm_init.c: move nr_initialised reset down a bit Wei Yang
2024-05-25 15:36 ` [Patch v3 1/3] mm/mm_init.c: use memblock_region_memory_base_pfn() to get startpfn Mike Rapoport

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox