From: Yajun Deng <yajun.deng@linux.dev>
To: akpm@linux-foundation.org, mike.kravetz@oracle.com,
muchun.song@linux.dev, glider@google.com, elver@google.com,
dvyukov@google.com, rppt@kernel.org, david@redhat.com,
osalvador@suse.de
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
kasan-dev@googlegroups.com, Yajun Deng <yajun.deng@linux.dev>
Subject: [PATCH 4/4] mm: don't set page count in deferred_init_pages
Date: Fri, 22 Sep 2023 15:09:23 +0800 [thread overview]
Message-ID: <20230922070923.355656-5-yajun.deng@linux.dev> (raw)
In-Reply-To: <20230922070923.355656-1-yajun.deng@linux.dev>
The operations of page count in deferred_init_pages and deferred_free_range
is the opposite operation. It's unnecessary and time-consuming.
Don't set page count in deferred_init_pages, as it'll be reset later.
The following data was tested on an x86 machine with 190GB of RAM.
before:
node 0 deferred pages initialised in 78ms
after:
node 0 deferred pages initialised in 72ms
Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
---
mm/mm_init.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/mm/mm_init.c b/mm/mm_init.c
index 1cc310f706a9..fe78f6916c66 100644
--- a/mm/mm_init.c
+++ b/mm/mm_init.c
@@ -1984,7 +1984,7 @@ static void __init deferred_free_range(unsigned long pfn,
if (nr_pages == MAX_ORDER_NR_PAGES && IS_MAX_ORDER_ALIGNED(pfn)) {
for (i = 0; i < nr_pages; i += pageblock_nr_pages)
set_pageblock_migratetype(page + i, MIGRATE_MOVABLE);
- __free_pages_core(page, MAX_ORDER, MEMINIT_LATE);
+ __free_pages_core(page, MAX_ORDER, MEMINIT_EARLY);
return;
}
@@ -1994,7 +1994,7 @@ static void __init deferred_free_range(unsigned long pfn,
for (i = 0; i < nr_pages; i++, page++, pfn++) {
if (pageblock_aligned(pfn))
set_pageblock_migratetype(page, MIGRATE_MOVABLE);
- __free_pages_core(page, 0, MEMINIT_LATE);
+ __free_pages_core(page, 0, MEMINIT_EARLY);
}
}
@@ -2068,7 +2068,7 @@ static unsigned long __init deferred_init_pages(struct zone *zone,
} else {
page++;
}
- __init_single_page(page, pfn, zid, nid, true, false);
+ __init_single_page(page, pfn, zid, nid, false, false);
nr_pages++;
}
return (nr_pages);
--
2.25.1
prev parent reply other threads:[~2023-09-22 7:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-22 7:09 [PATCH 0/4] mm: Don't set and reset page count in MEMINIT_EARLY Yajun Deng
2023-09-22 7:09 ` [PATCH 1/4] mm: pass set_count and set_reserved to __init_single_page Yajun Deng
2023-09-22 7:47 ` Matthew Wilcox
2023-09-22 7:48 ` David Hildenbrand
2023-09-22 8:08 ` Mike Rapoport
2023-09-25 3:23 ` Yajun Deng
2023-09-22 7:09 ` [PATCH 2/4] mm: Introduce MEMINIT_LATE context Yajun Deng
2023-09-22 7:09 ` [PATCH 3/4] mm: Set page count and mark page reserved in reserve_bootmem_region Yajun Deng
2023-09-22 7:09 ` Yajun Deng [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=20230922070923.355656-5-yajun.deng@linux.dev \
--to=yajun.deng@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=dvyukov@google.com \
--cc=elver@google.com \
--cc=glider@google.com \
--cc=kasan-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mike.kravetz@oracle.com \
--cc=muchun.song@linux.dev \
--cc=osalvador@suse.de \
--cc=rppt@kernel.org \
/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.