linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: linux-mm@kvack.org, virtualization@lists.linux.dev,
	"David Hildenbrand" <david@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Jason Wang" <jasowang@redhat.com>,
	"Xuan Zhuo" <xuanzhuo@linux.alibaba.com>,
	"Eugenio Pérez" <eperezma@redhat.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Oscar Salvador" <osalvador@suse.de>,
	"Vlastimil Babka" <vbabka@suse.cz>,
	"Suren Baghdasaryan" <surenb@google.com>,
	"Michal Hocko" <mhocko@suse.com>,
	"Brendan Jackman" <jackmanb@google.com>,
	"Johannes Weiner" <hannes@cmpxchg.org>, "Zi Yan" <ziy@nvidia.com>,
	"Matthew Wilcox (Oracle)" <willy@infradead.org>
Subject: [PATCH v1 2/2] mm/memory_hotplug: remove -EBUSY handling from scan_movable_pages()
Date: Wed, 14 May 2025 13:15:44 +0200	[thread overview]
Message-ID: <20250514111544.1012399-3-david@redhat.com> (raw)
In-Reply-To: <20250514111544.1012399-1-david@redhat.com>

Now that we can reliably identify PageOffline() pages that allow for
memory offlining in has_unmovable_pages(), start_isolate_page_range()
will fail on PageOffline() pages that would prevent memory offlining, and
we no longer have to detect them in scan_movable_pages() anymore.

Note that the previous mechanism relied on MEM_GOING_OFFLINE, whereby we
were not able to distinguish the types of PageOffline() before
MEM_GOING_OFFLINE.

Signed-off-by: David Hildenbrand <david@redhat.com>
---
 mm/memory_hotplug.c | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 0cc5537f234bb..beace5b695aee 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1743,13 +1743,11 @@ bool mhp_range_allowed(u64 start, u64 size, bool need_mapping)
 /*
  * Scan pfn range [start,end) to find movable/migratable pages (LRU pages,
  * non-lru movable pages and hugepages). Will skip over most unmovable
- * pages (esp., pages that can be skipped when offlining), but bail out on
- * definitely unmovable pages.
+ * pages (esp., pages that can be skipped when offlining).
  *
  * Returns:
  *	0 in case a movable page is found and movable_pfn was updated.
  *	-ENOENT in case no movable page was found.
- *	-EBUSY in case a definitely unmovable page was found.
  */
 static int scan_movable_pages(unsigned long start, unsigned long end,
 			      unsigned long *movable_pfn)
@@ -1766,13 +1764,6 @@ static int scan_movable_pages(unsigned long start, unsigned long end,
 		if (__PageMovable(page))
 			goto found;
 
-		/*
-		 * PageOffline() pages that are neither "movable" nor
-		 * "skippable" prevent memory offlining.
-		 */
-		if (PageOffline(page) && !PageOfflineSkippable(page))
-			return -EBUSY;
-
 		if (!PageHuge(page))
 			continue;
 		folio = page_folio(page);
@@ -2051,11 +2042,6 @@ int offline_pages(unsigned long start_pfn, unsigned long nr_pages,
 			}
 		} while (!ret);
 
-		if (ret != -ENOENT) {
-			reason = "unmovable page";
-			goto failed_removal_isolated;
-		}
-
 		/*
 		 * Dissolve free hugetlb folios in the memory block before doing
 		 * offlining actually in order to make hugetlbfs's object
-- 
2.49.0



  parent reply	other threads:[~2025-05-14 11:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-14 11:15 [PATCH v1 0/2] mm/memory_hotplug: introduce and use PG_offline_skippable David Hildenbrand
2025-05-14 11:15 ` [PATCH v1 1/2] mm/memory_hotplug: PG_offline_skippable for offlining memory blocks with PageOffline pages David Hildenbrand
2025-05-14 19:00   ` Zi Yan
2025-05-14 19:51     ` David Hildenbrand
2025-05-14 20:30       ` Zi Yan
2025-05-19 14:39         ` David Hildenbrand
2025-05-14 11:15 ` David Hildenbrand [this message]
2025-05-14 19:57   ` [PATCH v1 2/2] mm/memory_hotplug: remove -EBUSY handling from scan_movable_pages() David Hildenbrand
2025-05-14 13:45 ` [PATCH v1 0/2] mm/memory_hotplug: introduce and use PG_offline_skippable Zi Yan
2025-05-14 14:12   ` David Hildenbrand
2025-05-14 15:49     ` Zi Yan
2025-05-14 17:28       ` David Hildenbrand
2025-05-14 17:43         ` Zi Yan
2025-05-14 17:46           ` David Hildenbrand

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=20250514111544.1012399-3-david@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=eperezma@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=jackmanb@google.com \
    --cc=jasowang@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=mst@redhat.com \
    --cc=osalvador@suse.de \
    --cc=surenb@google.com \
    --cc=vbabka@suse.cz \
    --cc=virtualization@lists.linux.dev \
    --cc=willy@infradead.org \
    --cc=xuanzhuo@linux.alibaba.com \
    --cc=ziy@nvidia.com \
    /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).