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 <[email protected]>
---
 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


Reply via email to