Skip to contentSkip to conversation

mm/page_poison: move PAGE_POISON to page_poison.c

PATCH In review Wei Wang 3 participants 6 messages Feb 9, 2018 – Feb 26, 2018

Subsystems (3)
lore
Share & tools
lore

Wei Wang

author
#0 lore raw

PATCH 1/1 mm/page_poison: move PAGE_POISON to page_poison.c

The PAGE_POISON macro is used in page_poison.c only, so avoid exporting it. Also remove the "mm/debug-pagealloc.c" related comment, which is obsolete.

Cc Andrew Morton <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
---
 include/linux/poison.h | 7 -------
 mm/page_poison.c       | 6 ++++++
 2 files changed, 6 insertions(+), 7 deletions(-)
include/linux/poison.h +0 -7
index 15927eb..348bf67 100644
@@ -30,13 +30,6 @@
  */
 #define TIMER_ENTRY_STATIC	((void *) 0x300 + POISON_POINTER_DELTA)
 
-/********** mm/debug-pagealloc.c **********/
-#ifdef CONFIG_PAGE_POISONING_ZERO
-#define PAGE_POISON 0x00
-#else
-#define PAGE_POISON 0xaa
-#endif
-
 /********** mm/page_alloc.c ************/
 
 #define TAIL_MAPPING	((void *) 0x400 + POISON_POINTER_DELTA)
mm/page_poison.c +6 -0
index e83fd44..8aaf076 100644
@@ -7,6 +7,12 @@
 #include <linux/poison.h>
 #include <linux/ratelimit.h>
 
+#ifdef CONFIG_PAGE_POISONING_ZERO
+#define PAGE_POISON 0x00
+#else
+#define PAGE_POISON 0xaa
+#endif
+
 static bool want_page_poisoning __read_mostly;
 
 static int early_page_poison_param(char *buf)
Signature · 1 line
2.7.4
#1 lore raw
Quoted 21 lines · Wei Wang

The PAGE_POISON macro is used in page_poison.c only, so avoid exporting it. Also remove the "mm/debug-pagealloc.c" related comment, which is obsolete.

Cc Andrew Morton <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
---
 include/linux/poison.h | 7 -------
 mm/page_poison.c       | 6 ++++++
 2 files changed, 6 insertions(+), 7 deletions(-)
include/linux/poison.h +0 -0
index 15927eb..348bf67 100644
@@ -30,13 +30,6 @@
  */
 #define TIMER_ENTRY_STATIC	((void *) 0x300 + POISON_POINTER_DELTA)
 

include/linux/poison.h line 35

Quoted 10 lines
include/linux/poison.h +0 -7
-/********** mm/debug-pagealloc.c **********/
-#ifdef CONFIG_PAGE_POISONING_ZERO
-#define PAGE_POISON 0x00
-#else
-#define PAGE_POISON 0xaa
-#endif
-
 /********** mm/page_alloc.c ************/
 
 #define TAIL_MAPPING	((void *) 0x400 + POISON_POINTER_DELTA)

My question is, why are these macros kept in a single header. Is it so it's easy to figure out source of a crash by looking at the data and locating it in the file?
If so we should keep it in the header, but fix the comment. If no there are more macros to move out, like flex array ones.

Quoted 19 lines
mm/page_poison.c +6 -0
index e83fd44..8aaf076 100644
@@ -7,6 +7,12 @@
 #include <linux/poison.h>
 #include <linux/ratelimit.h>
 
+#ifdef CONFIG_PAGE_POISONING_ZERO
+#define PAGE_POISON 0x00
+#else
+#define PAGE_POISON 0xaa
+#endif
+
 static bool want_page_poisoning __read_mostly;
 
 static int early_page_poison_param(char *buf)
Signature · 1 line
2.7.4
#2 lore raw
In reply to Wei Wang
Quoted 21 lines · Wei Wang

The PAGE_POISON macro is used in page_poison.c only, so avoid exporting it. Also remove the "mm/debug-pagealloc.c" related comment, which is obsolete.

Cc Andrew Morton <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
---
 include/linux/poison.h | 7 -------
 mm/page_poison.c       | 6 ++++++
 2 files changed, 6 insertions(+), 7 deletions(-)
include/linux/poison.h +0 -0
index 15927eb..348bf67 100644
@@ -30,13 +30,6 @@
  */
 #define TIMER_ENTRY_STATIC	((void *) 0x300 + POISON_POINTER_DELTA)
 

include/linux/poison.h line 35

Quoted 10 lines
include/linux/poison.h +0 -7
-/********** mm/debug-pagealloc.c **********/
-#ifdef CONFIG_PAGE_POISONING_ZERO
-#define PAGE_POISON 0x00
-#else
-#define PAGE_POISON 0xaa
-#endif
-
 /********** mm/page_alloc.c ************/
 
 #define TAIL_MAPPING	((void *) 0x400 + POISON_POINTER_DELTA)

My question is, why are these macros kept in a single header. Is it so it's easy to figure out source of a crash by looking at the data and locating it in the file?
If so we should keep it in the header, but fix the comment. If no there are more macros to move out, like flex array ones.

Quoted 19 lines
mm/page_poison.c +6 -0
index e83fd44..8aaf076 100644
@@ -7,6 +7,12 @@
 #include <linux/poison.h>
 #include <linux/ratelimit.h>
 
+#ifdef CONFIG_PAGE_POISONING_ZERO
+#define PAGE_POISON 0x00
+#else
+#define PAGE_POISON 0xaa
+#endif
+
 static bool want_page_poisoning __read_mostly;
 
 static int early_page_poison_param(char *buf)
Signature · 1 line
2.7.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#3 lore raw
In reply to Wei Wang
Quoted 3 lines · Wei Wang

The PAGE_POISON macro is used in page_poison.c only, so avoid exporting it. Also remove the "mm/debug-pagealloc.c" related comment, which is obsolete.

Why is this an improvement? I thought the whole point of poison.h is to keep all the poison value at a single place to make them obviously unique.

Quoted 46 lines
Cc Andrew Morton <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
---
 include/linux/poison.h | 7 -------
 mm/page_poison.c       | 6 ++++++
 2 files changed, 6 insertions(+), 7 deletions(-)
include/linux/poison.h +0 -7
index 15927eb..348bf67 100644
@@ -30,13 +30,6 @@
  */
 #define TIMER_ENTRY_STATIC	((void *) 0x300 + POISON_POINTER_DELTA)
 
-/********** mm/debug-pagealloc.c **********/
-#ifdef CONFIG_PAGE_POISONING_ZERO
-#define PAGE_POISON 0x00
-#else
-#define PAGE_POISON 0xaa
-#endif
-
 /********** mm/page_alloc.c ************/
 
 #define TAIL_MAPPING	((void *) 0x400 + POISON_POINTER_DELTA)
mm/page_poison.c +6 -0
index e83fd44..8aaf076 100644
@@ -7,6 +7,12 @@
 #include <linux/poison.h>
 #include <linux/ratelimit.h>
 
+#ifdef CONFIG_PAGE_POISONING_ZERO
+#define PAGE_POISON 0x00
+#else
+#define PAGE_POISON 0xaa
+#endif
+
 static bool want_page_poisoning __read_mostly;
 
 static int early_page_poison_param(char *buf)
Signature · 1 line
2.7.4
Signature · 2 lines
Michal Hocko
SUSE Labs
#4 lore raw
In reply to Wei Wang
Quoted 3 lines · Wei Wang

The PAGE_POISON macro is used in page_poison.c only, so avoid exporting it. Also remove the "mm/debug-pagealloc.c" related comment, which is obsolete.

Why is this an improvement? I thought the whole point of poison.h is to keep all the poison value at a single place to make them obviously unique.

Quoted 46 lines
Cc Andrew Morton <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
---
 include/linux/poison.h | 7 -------
 mm/page_poison.c       | 6 ++++++
 2 files changed, 6 insertions(+), 7 deletions(-)
include/linux/poison.h +0 -7
index 15927eb..348bf67 100644
@@ -30,13 +30,6 @@
  */
 #define TIMER_ENTRY_STATIC	((void *) 0x300 + POISON_POINTER_DELTA)
 
-/********** mm/debug-pagealloc.c **********/
-#ifdef CONFIG_PAGE_POISONING_ZERO
-#define PAGE_POISON 0x00
-#else
-#define PAGE_POISON 0xaa
-#endif
-
 /********** mm/page_alloc.c ************/
 
 #define TAIL_MAPPING	((void *) 0x400 + POISON_POINTER_DELTA)
mm/page_poison.c +6 -0
index e83fd44..8aaf076 100644
@@ -7,6 +7,12 @@
 #include <linux/poison.h>
 #include <linux/ratelimit.h>
 
+#ifdef CONFIG_PAGE_POISONING_ZERO
+#define PAGE_POISON 0x00
+#else
+#define PAGE_POISON 0xaa
+#endif
+
 static bool want_page_poisoning __read_mostly;
 
 static int early_page_poison_param(char *buf)
Signature · 1 line
2.7.4
Signature · 8 lines
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
author
#5 lore raw
Quoted 7 lines · Michal Hocko
Quoted 3 lines · Wei Wang

The PAGE_POISON macro is used in page_poison.c only, so avoid exporting it. Also remove the "mm/debug-pagealloc.c" related comment, which is obsolete.

Why is this an improvement? I thought the whole point of poison.h is to keep all the poison value at a single place to make them obviously unique.

There isn't a comment explaining why they are exposed. We did this because PAGE_POISON is used by page_poison.c only, it seems not necessary to expose the private values. Why would it be not unique if moved to page_poison.c (on condition that it is only used there)?

Best,
Wei

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>