Skip to contentSkip to conversation

mm/debug: sync up latest migrate_reason to migrate_reason_names

PATCH In review Weizhao Ouyang 3 participants 11 messages Sep 21, 2021 – Sep 22, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v2 cover mm/debug: sync up latest migrate_reason to migrate_reason_names

After related migrate page updates, sync up latest migrate_reason to migrate_reason_names, page_owner use it to parse the page migrate reason.

Changes in V2:
-- sync up MR_CONTIG_RANGE
-- split patchset for stable kernel

Weizhao Ouyang (2):
mm/debug: sync up MR_CONTIG_RANGE and MR_LONGTERM_PIN mm/debug: sync up latest migrate_reason to migrate_reason_names

 include/linux/migrate.h | 6 +++++-
 mm/debug.c              | 4 +++-
 2 files changed, 8 insertions(+), 2 deletions(-)
Signature · 1 line
2.30.2
#1 lore raw

PATCH v2 1/2 mm/debug: sync up MR_CONTIG_RANGE and MR_LONGTERM_PIN

Sync up MR_CONTIG_RANGE and MR_LONGTERM_PIN to migrate_reason_names.

Fixes 310253514bbf ("mm/migrate: rename migration reason MR_CMA to MR_CONTIG_RANGE")
Fixes d1e153fea2a8 ("mm/gup: migrate pinned pages out of movable zone")
---
 mm/debug.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
mm/debug.c +2 -1
index e73fe0a8ec3d..e61037cded98 100644
@@ -24,7 +24,8 @@ const char *migrate_reason_names[MR_TYPES] = {
 	"syscall_or_cpuset",
 	"mempolicy_mbind",
 	"numa_misplaced",
-	"cma",
+	"contig_range",
+	"longterm_pin",
 };
 
 const struct trace_print_flags pageflag_names[] = {
Signature · 1 line
2.30.2
Reviewed-by on v2 1/2
#2 lore raw

Re: [PATCH v2 1/2] mm/debug: sync up MR_CONTIG_RANGE and MR_LONGTERM_PIN

Quoted 17 lines · Weizhao Ouyang

Sync up MR_CONTIG_RANGE and MR_LONGTERM_PIN to migrate_reason_names.

Fixes 310253514bbf ("mm/migrate: rename migration reason MR_CMA to MR_CONTIG_RANGE")
Fixes d1e153fea2a8 ("mm/gup: migrate pinned pages out of movable zone")
---
  mm/debug.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
mm/debug.c +0 -0
index e73fe0a8ec3d..e61037cded98 100644

mm/debug.c const char *migrate_reason_names[MR_TYPES] = { · line 31

Quoted 9 lines
mm/debug.c +2 -1
@@ -24,7 +24,8 @@ const char *migrate_reason_names[MR_TYPES] = {
  	"syscall_or_cpuset",
  	"mempolicy_mbind",
  	"numa_misplaced",
-	"cma",
+	"contig_range",
+	"longterm_pin",
  };
 
  const struct trace_print_flags pageflag_names[] = {

Looks good.

thanks,

Signature · 2 lines
John Hubbard
NVIDIA
#3 lore raw

PATCH v2 2/2 mm/debug: sync up latest migrate_reason to migrate_reason_names

In reply to Weizhao Ouyang

Sync up MR_DEMOTION to migrate_reason_names and add a synch prompt.

Fixes 26aa2d199d6f ("mm/migrate: demote pages during reclaim")
---
 include/linux/migrate.h | 6 +++++-
 mm/debug.c              | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)
include/linux/migrate.h +5 -1
index 326250996b4e..c8077e936691 100644
@@ -19,6 +19,11 @@ struct migration_target_control;
  */
 #define MIGRATEPAGE_SUCCESS		0
 
+/*
+ * Keep sync with:
+ * - macro MIGRATE_REASON in include/trace/events/migrate.h
+ * - migrate_reason_names[MR_TYPES] in mm/debug.c
+ */
 enum migrate_reason {
 	MR_COMPACTION,
 	MR_MEMORY_FAILURE,
@@ -32,7 +37,6 @@ enum migrate_reason {
 	MR_TYPES
 };
 
-/* In mm/debug.c; also keep sync with include/trace/events/migrate.h */
 extern const char *migrate_reason_names[MR_TYPES];
 
 #ifdef CONFIG_MIGRATION
mm/debug.c +1 -0
index e61037cded98..fae0f81ad831 100644
@@ -26,6 +26,7 @@ const char *migrate_reason_names[MR_TYPES] = {
 	"numa_misplaced",
 	"contig_range",
 	"longterm_pin",
+	"demotion",
 };
 
 const struct trace_print_flags pageflag_names[] = {
Signature · 1 line
2.30.2
#4 lore raw
Quoted 39 lines · Weizhao Ouyang

Sync up MR_DEMOTION to migrate_reason_names and add a synch prompt.

Fixes 26aa2d199d6f ("mm/migrate: demote pages during reclaim")
---
 include/linux/migrate.h | 6 +++++-
 mm/debug.c              | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)
include/linux/migrate.h +5 -1
index 326250996b4e..c8077e936691 100644
@@ -19,6 +19,11 @@ struct migration_target_control;
  */
 #define MIGRATEPAGE_SUCCESS		0
 
+/*
+ * Keep sync with:
+ * - macro MIGRATE_REASON in include/trace/events/migrate.h
+ * - migrate_reason_names[MR_TYPES] in mm/debug.c
+ */
 enum migrate_reason {
 	MR_COMPACTION,
 	MR_MEMORY_FAILURE,
@@ -32,7 +37,6 @@ enum migrate_reason {
 	MR_TYPES
 };
 
-/* In mm/debug.c; also keep sync with include/trace/events/migrate.h */
 extern const char *migrate_reason_names[MR_TYPES];
 
 #ifdef CONFIG_MIGRATION
mm/debug.c +0 -0
index e61037cded98..fae0f81ad831 100644

mm/debug.c const char *migrate_reason_names[MR_TYPES] = { · line 32

Quoted 7 lines
mm/debug.c +1 -0
@@ -26,6 +26,7 @@ const char *migrate_reason_names[MR_TYPES] = {
 	"numa_misplaced",
 	"contig_range",
 	"longterm_pin",
+	"demotion",
 };
 
 const struct trace_print_flags pageflag_names[] = {

Can we add BUILD_BUG_ON() somewhere to capture at least some synchronization issue?

Best Regards,
Huang, Ying

#5 lore raw
Quoted 47 lines · Ying
Quoted 45 lines · Weizhao Ouyang

Sync up MR_DEMOTION to migrate_reason_names and add a synch prompt.

Fixes 26aa2d199d6f ("mm/migrate: demote pages during reclaim")
---
 include/linux/migrate.h | 6 +++++-
 mm/debug.c              | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)
include/linux/migrate.h +5 -1
index 326250996b4e..c8077e936691 100644
@@ -19,6 +19,11 @@ struct migration_target_control;
  */
 #define MIGRATEPAGE_SUCCESS		0
 
+/*
+ * Keep sync with:
+ * - macro MIGRATE_REASON in include/trace/events/migrate.h
+ * - migrate_reason_names[MR_TYPES] in mm/debug.c
+ */
 enum migrate_reason {
 	MR_COMPACTION,
 	MR_MEMORY_FAILURE,
@@ -32,7 +37,6 @@ enum migrate_reason {
 	MR_TYPES
 };
 
-/* In mm/debug.c; also keep sync with include/trace/events/migrate.h */
 extern const char *migrate_reason_names[MR_TYPES];
 
 #ifdef CONFIG_MIGRATION
mm/debug.c +1 -0
index e61037cded98..fae0f81ad831 100644
@@ -26,6 +26,7 @@ const char *migrate_reason_names[MR_TYPES] = {
 	"numa_misplaced",
 	"contig_range",
 	"longterm_pin",
+	"demotion",
 };
 
Quoted 3 lines

mm/debug.c const char *migrate_reason_names[MR_TYPES] = { · line 32

Quoted 1 line
mm/debug.c +0 -0
 const struct trace_print_flags pageflag_names[] = {

Can we add BUILD_BUG_ON() somewhere to capture at least some synchronization issue?

Hi Huang, we discussed this in the v1 thread with you and John, seems you missed it. Now we just add a comment to do the synchronization, and we can figure out a more general way to use strings which in trace_events straight.

Thanks,
Weizhao

#6 lore raw
Quoted 48 lines · Weizhao Ouyang
Quoted 47 lines · Ying
Quoted 45 lines · Weizhao Ouyang

Sync up MR_DEMOTION to migrate_reason_names and add a synch prompt.

Fixes 26aa2d199d6f ("mm/migrate: demote pages during reclaim")
---
 include/linux/migrate.h | 6 +++++-
 mm/debug.c              | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)
include/linux/migrate.h +5 -1
index 326250996b4e..c8077e936691 100644
@@ -19,6 +19,11 @@ struct migration_target_control;
  */
 #define MIGRATEPAGE_SUCCESS		0
 
+/*
+ * Keep sync with:
+ * - macro MIGRATE_REASON in include/trace/events/migrate.h
+ * - migrate_reason_names[MR_TYPES] in mm/debug.c
+ */
 enum migrate_reason {
 	MR_COMPACTION,
 	MR_MEMORY_FAILURE,
@@ -32,7 +37,6 @@ enum migrate_reason {
 	MR_TYPES
 };
 
-/* In mm/debug.c; also keep sync with include/trace/events/migrate.h */
 extern const char *migrate_reason_names[MR_TYPES];
 
 #ifdef CONFIG_MIGRATION
mm/debug.c +1 -0
index e61037cded98..fae0f81ad831 100644
@@ -26,6 +26,7 @@ const char *migrate_reason_names[MR_TYPES] = {
 	"numa_misplaced",
 	"contig_range",
 	"longterm_pin",
+	"demotion",
 };
 
Quoted 7 lines
Quoted 3 lines

mm/debug.c const char *migrate_reason_names[MR_TYPES] = { · line 32

Quoted 1 line
mm/debug.c +0 -0
 const struct trace_print_flags pageflag_names[] = {

Can we add BUILD_BUG_ON() somewhere to capture at least some synchronization issue?

Hi Huang, we discussed this in the v1 thread with you and John, seems you missed it. Now we just add a comment to do the synchronization, and we can figure out a more general way to use strings which in trace_events straight.

Got it! And I think we can add the BUILD_BUG_ON() now and delete it when we have a better solution to deal with that. But if you can work out a better solution quickly, that's fine to ignore this.

Best Regards,
Huang, Ying

#7 lore raw

On 9/21/21 07:06, Huang, Ying wrote:
...

Quoted 11 lines
Quoted 6 lines
Quoted 2 lines

Can we add BUILD_BUG_ON() somewhere to capture at least some synchronization issue?

Hi Huang, we discussed this in the v1 thread with you and John, seems you missed it. Now we just add a comment to do the synchronization, and we can figure out a more general way to use strings which in trace_events straight.

Got it! And I think we can add the BUILD_BUG_ON() now and delete it when we have a better solution to deal with that. But if you can work out a better solution quickly, that's fine to ignore this.

I have a solution now, it's basically what I sent earlier. There appears to be some confusion about it. I'll send it out as a patch that builds on top of these two, hopefully in a few hours, if no problems pop up during testing.

thanks,

Signature · 2 lines
John Hubbard
NVIDIA
#8 lore raw
Quoted 9 lines · John Hubbard

On 9/21/21 07:06, Huang, Ying wrote:
...

Quoted 7 lines
Quoted 6 lines
Quoted 2 lines

Can we add BUILD_BUG_ON() somewhere to capture at least some synchronization issue?

Hi Huang, we discussed this in the v1 thread with you and John, seems you missed it. Now we just add a comment to do the synchronization, and we can figure out a more general way to use strings which in trace_events straight.

Quoted 9 lines
Quoted 4 lines

Got it!  And I think we can add the BUILD_BUG_ON() now and delete it when we have a better solution to deal with that.  But if you can work out a better solution quickly, that's fine to ignore this.

I have a solution now, it's basically what I sent earlier. There appears to be some confusion about it. I'll send it out as a patch that builds on top of these two, hopefully in a few hours, if no problems pop up during testing.

Oh OK, I think the confusion was on my end: you are hoping to integrate the TRACE_DEFINE_ENUM in with this. Let me take a peek there, because otherwise, we can only reduce, but not fully remove the duplication.

thanks,

Signature · 2 lines
John Hubbard
NVIDIA
#9 lore raw
In reply to John Hubbard
Quoted 8 lines · John Hubbard

On 9/21/21 07:06, Huang, Ying wrote:
...

Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

Can we add BUILD_BUG_ON() somewhere to capture at least some synchronization issue?

Hi Huang, we discussed this in the v1 thread with you and John, seems you missed it. Now we just add a comment to do the synchronization, and we can figure out a more general way to use strings which in trace_events straight.

Quoted 8 lines
Quoted 4 lines

Got it! And I think we can add the BUILD_BUG_ON() now and delete it when we have a better solution to deal with that. But if you can work out a better solution quickly, that's fine to ignore this.

I have a solution now, it's basically what I sent earlier. There appears to be some confusion about it. I'll send it out as a patch that builds on top of these two, hopefully in a few hours, if no problems pop up during testing.

Sorry, I didn't read your latest email. The solution looks good! Thanks!

Best Regards,
Huang, Ying

Reviewed-by on v2 2/2
#10 lore raw
In reply to Weizhao Ouyang
Quoted 40 lines · Weizhao Ouyang

Sync up MR_DEMOTION to migrate_reason_names and add a synch prompt.

Fixes 26aa2d199d6f ("mm/migrate: demote pages during reclaim")
---
  include/linux/migrate.h | 6 +++++-
  mm/debug.c              | 1 +
  2 files changed, 6 insertions(+), 1 deletion(-)
include/linux/migrate.h +5 -1
index 326250996b4e..c8077e936691 100644
@@ -19,6 +19,11 @@ struct migration_target_control;
   */
  #define MIGRATEPAGE_SUCCESS		0
 
+/*
+ * Keep sync with:
+ * - macro MIGRATE_REASON in include/trace/events/migrate.h
+ * - migrate_reason_names[MR_TYPES] in mm/debug.c
+ */
  enum migrate_reason {
  	MR_COMPACTION,
  	MR_MEMORY_FAILURE,
@@ -32,7 +37,6 @@ enum migrate_reason {
  	MR_TYPES
  };
 
-/* In mm/debug.c; also keep sync with include/trace/events/migrate.h */
  extern const char *migrate_reason_names[MR_TYPES];
 
  #ifdef CONFIG_MIGRATION
mm/debug.c +0 -0
index e61037cded98..fae0f81ad831 100644

mm/debug.c const char *migrate_reason_names[MR_TYPES] = { · line 32

Quoted 7 lines
mm/debug.c +1 -0
@@ -26,6 +26,7 @@ const char *migrate_reason_names[MR_TYPES] = {
  	"numa_misplaced",
  	"contig_range",
  	"longterm_pin",
+	"demotion",
  };
 
  const struct trace_print_flags pageflag_names[] = {

Looks good.

thanks,

Signature · 2 lines
John Hubbard
NVIDIA