summaryrefslogtreecommitdiff
path: root/mm/mm_init.c
diff options
context:
space:
mode:
authorWei Yang <richard.weiyang@gmail.com>2024-05-25 02:30:40 +0000
committerMike Rapoport (IBM) <rppt@kernel.org>2024-06-05 10:28:10 +0300
commit922306a253e20ad5d0c4b8479d2dc5df9f325a04 (patch)
tree06c2b48ecc4d7b9c08a894129f24d301147cff47 /mm/mm_init.c
parent93bbbcb1e762a49fc18ee1272545b77371595f1e (diff)
mm/mm_init.c: move nr_initialised reset down a bit
We don't need to count nr_initialised in two cases: * for low zones that are always populated * 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> Link: https://lore.kernel.org/r/20240525023040.13509-3-richard.weiyang@gmail.com Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>
Diffstat (limited to 'mm/mm_init.c')
-rw-r--r--mm/mm_init.c14
1 files 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.