linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Wei Yang <richard.weiyang@gmail.com>
To: akpm@linux-foundation.org, rppt@kernel.org
Cc: linux-mm@kvack.org, Wei Yang <richard.weiyang@gmail.com>,
	Nathan Zimmer <nzimmer@sgi.com>,
	David Hildenbrand <david@redhat.com>
Subject: [PATCH 2/4] mm: not __SetPageReserved on initializing hot-plugged memory
Date: Sat, 29 Jun 2024 01:33:20 +0000	[thread overview]
Message-ID: <20240629013322.12364-2-richard.weiyang@gmail.com> (raw)
In-Reply-To: <20240629013322.12364-1-richard.weiyang@gmail.com>

Initialize all pages reserved is an ancient behavior.

Since commit 92923ca3aace ("mm: meminit: only set page reserved in the
memblock region"), SetPageReserved is removed from
__init_single_page(). Only those reserved pages are marked PG_reserved.

But we still set PG_reserved on offline and check it on online.

Following two commits removed both of them:

* Commit 0ee5f4f31d36 ("mm/page_alloc.c: don't set pages PageReserved()
  when offlining") removed the set on offline.
* Commit 5ecae6359e3a ("mm/memory_hotplug: drop PageReserved() check in
  online_pages_range()") removed the check on online.

This means we set PG_reserved for hot-plugged memory at initialization
is not helpful and a little different from bootmem initialization path.
Now we can remove it.

Memory hot-add and hot-remove have been tested.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
CC: Nathan Zimmer <nzimmer@sgi.com>
CC: David Hildenbrand <david@redhat.com>
CC: Mike Rapoport (IBM) <rppt@kernel.org>
---
 mm/mm_init.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/mm/mm_init.c b/mm/mm_init.c
index 3ec04933f7fd..362ac4334b99 100644
--- a/mm/mm_init.c
+++ b/mm/mm_init.c
@@ -839,9 +839,8 @@ static void __init init_unavailable_range(unsigned long spfn,
 }
 
 /*
- * Initially all pages are reserved - free ones are freed
- * up by memblock_free_all() once the early boot process is
- * done. Non-atomic initialization, single-pass.
+ * Free ones are freed up by memblock_free_all() once the early boot process
+ * is done. Non-atomic initialization, single-pass.
  *
  * All aligned pageblocks are initialized to the specified migratetype
  * (usually MIGRATE_MOVABLE). Besides setting the migratetype, no related
@@ -892,8 +891,6 @@ void __meminit memmap_init_range(unsigned long size, int nid, unsigned long zone
 
 		page = pfn_to_page(pfn);
 		__init_single_page(page, pfn, zone, nid);
-		if (context == MEMINIT_HOTPLUG)
-			__SetPageReserved(page);
 
 		/*
 		 * Usually, we want to mark the pageblock MIGRATE_MOVABLE,
-- 
2.34.1



  reply	other threads:[~2024-06-29  1:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-29  1:33 [PATCH 1/4] mm: use zonelist_zone() to get zone Wei Yang
2024-06-29  1:33 ` Wei Yang [this message]
2024-06-29  6:19   ` [PATCH 2/4] mm: not __SetPageReserved on initializing hot-plugged memory David Hildenbrand
2024-06-29  8:32     ` Wei Yang
2024-06-29 14:38       ` David Hildenbrand
2024-06-30  7:32         ` Wei Yang
2024-06-29  1:33 ` [PATCH 3/4] mm/page_alloc: put __free_pages_core() in __meminit section Wei Yang
2024-06-29  1:33 ` [PATCH 4/4] mm/page_alloc: no need to ClearPageReserved on giving page to buddy system Wei Yang
2024-06-29  3:21   ` Matthew Wilcox
2024-06-29  8:44     ` Wei Yang
2024-06-29 16:28       ` Matthew Wilcox
2024-06-29 16:45         ` Matthew Wilcox
2024-06-30  7:30           ` Wei Yang
     [not found]   ` <4a93f7b7-8ba8-4877-99c7-1048674d074d@redhat.com>
     [not found]     ` <299a4d6a-6b76-49b7-be2e-573cd66fd46f@redhat.com>
2024-06-29  8:48       ` Wei Yang

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=20240629013322.12364-2-richard.weiyang@gmail.com \
    --to=richard.weiyang@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=linux-mm@kvack.org \
    --cc=nzimmer@sgi.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).