Thread (6 messages) 6 messages, 3 authors, 5d ago

Re: [PATCH v6 2/9] mm/page_owner: add MR_NEVER to enum migrate_reason and use it for last_migrate_reason

From: "Vlastimil Babka (SUSE)" <vbabka@kernel.org>
Date: 2026-07-14 13:49:54
Also in: linux-mm, lkml

On 7/14/26 15:22, David Hildenbrand (Arm) wrote:
On 7/14/26 15:09, Vlastimil Babka (SUSE) wrote:
quoted
On 7/14/26 15:05, David Hildenbrand (Arm) wrote:
quoted
On 7/14/26 03:51, Ye Liu wrote:
quoted
The last_migrate_reason field uses -1 as a sentinel value to mean "no
migration has happened".  Replace the four bare -1 occurrences by
adding a proper MR_NEVER member to enum migrate_reason, defining a
corresponding "never_migrated" string in the MIGRATE_REASON trace
macro, and updating the GDB page_owner script to use MR_NEVER instead
of the hardcoded -1 so that lx-dump-page-owner does not incorrectly
report unmigrated pages as migrated.

No functional change.

Signed-off-by: Ye Liu <redacted>
Reviewed-by: Zi Yan <ziy@nvidia.com>
Reviewed-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
---
 include/linux/migrate_mode.h    | 1 +
 include/trace/events/migrate.h  | 3 ++-
 mm/page_owner.c                 | 8 ++++----
 scripts/gdb/linux/page_owner.py | 4 +++-
 4 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/include/linux/migrate_mode.h b/include/linux/migrate_mode.h
index 265c4328b36a..05102d4d2490 100644
--- a/include/linux/migrate_mode.h
+++ b/include/linux/migrate_mode.h
@@ -25,6 +25,7 @@ enum migrate_reason {
 	MR_LONGTERM_PIN,
 	MR_DEMOTION,
 	MR_DAMON,
+	MR_NEVER,		/* page has never been migrated */
Shouldn't this be more like

"MR_NONE" ?

As "never" is not really a "reason" ?
It's not used ever as a reason that would be actually passed to migration.
Right, it's a placeholder for "there is no migrate reason because it is unset"
quoted
So I think the name is more descriptive this way.
Not sure I agree. The usual translation of -1 -> unset is NONE or UNSET.
(note it's no longer -1 after the patch.)
At least I was confused by "NEVER".
I won't bikeshed this, so whatever.

Just to avoid another extra respin, please also say how the following line
should change, as if we only rename MR_NEVER to MR_NONE, it will be:

+	EMe(MR_NONE,		"never_migrated")

Is that ok? Note it should never be actually printed anywhere per the
current code.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help