Skip to contentSkip to conversation

mm: make "migrate_reason_names[]" const char *

PATCH In review Alexey Dobriyan 3 participants 3 messages Nov 24, 2018 – Nov 29, 2018

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

PATCH 1/1 mm: make "migrate_reason_names[]" const char *

Those strings are immutable as well.

---

 include/linux/migrate.h |    2 +-
 mm/debug.c              |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
include/linux/migrate.h +1 -1
@@ -29,7 +29,7 @@ enum migrate_reason {
 };
 
 /* In mm/debug.c; also keep sync with include/trace/events/migrate.h */
-extern char *migrate_reason_names[MR_TYPES];
+extern const char *migrate_reason_names[MR_TYPES];
 
 static inline struct page *new_page_nodemask(struct page *page,
 				int preferred_nid, nodemask_t *nodemask)
mm/debug.c +1 -1
@@ -17,7 +17,7 @@
 
 #include "internal.h"
 
-char *migrate_reason_names[MR_TYPES] = {
+const char *migrate_reason_names[MR_TYPES] = {
 	"compaction",
 	"memory_failure",
 	"memory_hotplug",
Acked-by on v1 1/1
#1 lore raw
Quoted 3 lines · Alexey Dobriyan

Those strings are immutable as well.

Sounds a bit random, but why not.

Quoted 29 lines

---

 include/linux/migrate.h |    2 +-
 mm/debug.c              |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
include/linux/migrate.h +1 -1
@@ -29,7 +29,7 @@ enum migrate_reason {
 };
 
 /* In mm/debug.c; also keep sync with include/trace/events/migrate.h */
-extern char *migrate_reason_names[MR_TYPES];
+extern const char *migrate_reason_names[MR_TYPES];
 
 static inline struct page *new_page_nodemask(struct page *page,
 				int preferred_nid, nodemask_t *nodemask)
mm/debug.c +1 -1
@@ -17,7 +17,7 @@
 
 #include "internal.h"
 
-char *migrate_reason_names[MR_TYPES] = {
+const char *migrate_reason_names[MR_TYPES] = {
 	"compaction",
 	"memory_failure",
 	"memory_hotplug",
Reviewed-by on v1 1/1
#2 lore raw
In reply to Alexey Dobriyan
Quoted 24 lines · Alexey Dobriyan

Those strings are immutable as well.

---

 include/linux/migrate.h |    2 +-
 mm/debug.c              |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
include/linux/migrate.h +1 -1
@@ -29,7 +29,7 @@ enum migrate_reason {
 };
 
 /* In mm/debug.c; also keep sync with include/trace/events/migrate.h */
-extern char *migrate_reason_names[MR_TYPES];
+extern const char *migrate_reason_names[MR_TYPES];
 
 static inline struct page *new_page_nodemask(struct page *page,
 				int preferred_nid, nodemask_t *nodemask)

mm/debug.c line 23

Quoted 8 lines
mm/debug.c +1 -1
@@ -17,7 +17,7 @@
 
 #include "internal.h"
 
-char *migrate_reason_names[MR_TYPES] = {
+const char *migrate_reason_names[MR_TYPES] = {
 	"compaction",
 	"memory_failure",
 	"memory_hotplug",
Signature · 3 lines
Thanks,

David / dhildenb