From: SeongJae Park <sj@kernel.org>
To: akpm@linux-foundation.org
Cc: david@redhat.com, osalvador@suse.de, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, SeongJae Park <sj@kernel.org>
Subject: [PATCH] mm/memory_hotplug: return zero from do_migrate_range() for only success
Date: Tue, 14 Feb 2023 22:32:36 +0000 [thread overview]
Message-ID: <20230214223236.58430-1-sj@kernel.org> (raw)
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@kernel.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
next reply other threads:[~2023-02-14 22:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-14 22:32 SeongJae Park [this message]
2023-02-15 13:16 ` David Hildenbrand
2023-02-15 18:03 ` SeongJae Park
2023-02-15 20:00 ` David Hildenbrand
2023-02-15 22:33 ` SeongJae Park
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=20230214223236.58430-1-sj@kernel.org \
--to=sj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=osalvador@suse.de \
/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