lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 14 Feb 2023 22:32:36 +0000
From:   SeongJae Park <sj@...nel.org>
To:     akpm@...ux-foundation.org
Cc:     david@...hat.com, osalvador@...e.de, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org, SeongJae Park <sj@...nel.org>
Subject: [PATCH] mm/memory_hotplug: return zero from do_migrate_range() for only success

do_migrate_range() returns migrate_pages() return value, which zero
means perfect success, in usual cases.  If all pages are failed to be
isolated, however, it returns isolate_{lru,movalbe}_page() return
values, or zero if all pfn were invalid, were hugetlb or hwpoisoned.  So
do_migrate_range() returning zero means either perfect success, or
special cases of isolation total failure.

Actually, the return value is not checked by any caller, so it might be
better to simply make it a void function.  However, there is a TODO for
checking the return value.

Make it easier to understand what it means.

Signed-off-by: SeongJae Park <sj@...nel.org>
---
 mm/memory_hotplug.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index a1e8c3e9ab08..db2c02d502a2 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1620,6 +1620,12 @@ static int scan_movable_pages(unsigned long start, unsigned long end,
 	return 0;
 }
 
+/*
+ * migrate pages in the given pfn range.
+ *
+ * Returns the number of {normal folio, large folio, hugetlb} that were not
+ * migrated, or an error code.
+ */
 static int
 do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)
 {
@@ -1685,6 +1691,7 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)
 		}
 		put_page(page);
 	}
+	ret = -ENOENT;
 	if (!list_empty(&source)) {
 		nodemask_t nmask = node_states[N_MEMORY];
 		struct migration_target_control mtc = {
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ