Skip to contentSkip to conversation

mm/sparse: rename pfn_present() as pfn_to_section_present()

PATCH Superseded Pingfan Liu 3 participants 6 messages Feb 15, 2020 – Feb 18, 2020

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

PATCH 1/1 mm/sparse: rename pfn_present() as pfn_to_section_present()

After introducing mem sub section concept, pfn_present() loses its literal meaning, and will not be necessary a truth on partial populated mem section.

Since all of the callers use it to judge an absent section, it is better to rename pfn_present() as pfn_to_section_present().

Cc Dan Williams <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc "Rafael J. Wysocki" <[email protected]>
Cc Andrew Morton <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc Leonardo Bras <[email protected]>
Cc Nathan Fontenot <[email protected]>
Cc Nathan Lynch <[email protected]>

To: [email protected]

---
 arch/powerpc/platforms/pseries/hotplug-memory.c | 2 +-
 drivers/base/node.c                             | 2 +-
 include/linux/mmzone.h                          | 4 ++--
 mm/page_ext.c                                   | 2 +-
 mm/shuffle.c                                    | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)
arch/powerpc/platforms/pseries/hotplug-memory.c +1 -1
index a4d40a3..5088132 100644
@@ -360,7 +360,7 @@ static bool lmb_is_removable(struct drmem_lmb *lmb)
 
 	for (i = 0; i < scns_per_block; i++) {
 		pfn = PFN_DOWN(phys_addr);
-		if (!pfn_present(pfn)) {
+		if (!pfn_to_section_present(pfn)) {
 			phys_addr += MIN_MEMORY_BLOCK_SIZE;
 			continue;
 		}
drivers/base/node.c +1 -1
index 98a31ba..6f98568 100644
@@ -772,7 +772,7 @@ static int register_mem_sect_under_node(struct memory_block *mem_blk,
 		 * memory block could have several absent sections from start.
 		 * skip pfn range from absent section
 		 */
-		if (!pfn_present(pfn)) {
+		if (!pfn_to_section_present(pfn)) {
 			pfn = round_down(pfn + PAGES_PER_SECTION,
 					 PAGES_PER_SECTION) - 1;
 			continue;
include/linux/mmzone.h +2 -2
index 462f687..eca2db7 100644
@@ -1372,7 +1372,7 @@ static inline int pfn_valid(unsigned long pfn)
 }
 #endif
 
-static inline int pfn_present(unsigned long pfn)
+static inline int pfn_to_section_present(unsigned long pfn)
 {
 	if (pfn_to_section_nr(pfn) >= NR_MEM_SECTIONS)
 		return 0;
@@ -1409,7 +1409,7 @@ void sparse_init(void);
 #else
 #define sparse_init()	do {} while (0)
 #define sparse_index_init(_sec, _nid)  do {} while (0)
-#define pfn_present pfn_valid
+#define pfn_to_section_present pfn_valid
 #define subsection_map_init(_pfn, _nr_pages) do {} while (0)
 #endif /* CONFIG_SPARSEMEM */
 
mm/page_ext.c +1 -1
index 4ade843..df0e55e 100644
@@ -304,7 +304,7 @@ static int __meminit online_page_ext(unsigned long start_pfn,
 	}
 
 	for (pfn = start; !fail && pfn < end; pfn += PAGES_PER_SECTION) {
-		if (!pfn_present(pfn))
+		if (!pfn_to_section_present(pfn))
 			continue;
 		fail = init_section_page_ext(pfn, nid);
 	}
mm/shuffle.c +1 -1
index b3fe97f..9242cc8 100644
@@ -72,7 +72,7 @@ static struct page * __meminit shuffle_valid_page(unsigned long pfn, int order)
 		return NULL;
 
 	/* ...is the pfn in a present section or a hole? */
-	if (!pfn_present(pfn))
+	if (!pfn_to_section_present(pfn))
 		return NULL;
 
 	/* ...is the page free and currently on a free_area list? */
Signature · 1 line
2.7.5
#1 lore raw
Quoted 9 lines

Am 15.02.2020 um 07:19 schrieb Pingfan Liu <[email protected]>:

After introducing mem sub section concept, pfn_present() loses its literal meaning, and will not be necessary a truth on partial populated mem section.

Since all of the callers use it to judge an absent section, it is better to rename pfn_present() as pfn_to_section_present().

IMHO, the name is not any better.

pfn_in_present_section?

Cheers!

Quoted 100 lines
Cc Dan Williams <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc "Rafael J. Wysocki" <[email protected]>
Cc Andrew Morton <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc Leonardo Bras <[email protected]>
Cc Nathan Fontenot <[email protected]>
Cc Nathan Lynch <[email protected]>

To: [email protected]
---

arch/powerpc/platforms/pseries/hotplug-memory.c | 2 +-
drivers/base/node.c                             | 2 +-
include/linux/mmzone.h                          | 4 ++--
mm/page_ext.c                                   | 2 +-
mm/shuffle.c                                    | 2 +-
5 files changed, 6 insertions(+), 6 deletions(-)
arch/powerpc/platforms/pseries/hotplug-memory.c +1 -1
index a4d40a3..5088132 100644
@@ -360,7 +360,7 @@ static bool lmb_is_removable(struct drmem_lmb *lmb)
 
   for (i = 0; i < scns_per_block; i++) {
       pfn = PFN_DOWN(phys_addr);
-        if (!pfn_present(pfn)) {
+        if (!pfn_to_section_present(pfn)) {
           phys_addr += MIN_MEMORY_BLOCK_SIZE;
           continue;
       }
drivers/base/node.c +1 -1
index 98a31ba..6f98568 100644
@@ -772,7 +772,7 @@ static int register_mem_sect_under_node(struct memory_block *mem_blk,
        * memory block could have several absent sections from start.
        * skip pfn range from absent section
        */
-        if (!pfn_present(pfn)) {
+        if (!pfn_to_section_present(pfn)) {
           pfn = round_down(pfn + PAGES_PER_SECTION,
                    PAGES_PER_SECTION) - 1;
           continue;
include/linux/mmzone.h +2 -2
index 462f687..eca2db7 100644
@@ -1372,7 +1372,7 @@ static inline int pfn_valid(unsigned long pfn)
 }
 #endif
 
-static inline int pfn_present(unsigned long pfn)
+static inline int pfn_to_section_present(unsigned long pfn)
 {
   if (pfn_to_section_nr(pfn) >= NR_MEM_SECTIONS)
       return 0;
@@ -1409,7 +1409,7 @@ void sparse_init(void);
 #else
 #define sparse_init()    do {} while (0)
 #define sparse_index_init(_sec, _nid)  do {} while (0)
-#define pfn_present pfn_valid
+#define pfn_to_section_present pfn_valid
 #define subsection_map_init(_pfn, _nr_pages) do {} while (0)
 #endif /* CONFIG_SPARSEMEM */
 
mm/page_ext.c +1 -1
index 4ade843..df0e55e 100644
@@ -304,7 +304,7 @@ static int __meminit online_page_ext(unsigned long start_pfn,
   }
 
   for (pfn = start; !fail && pfn < end; pfn += PAGES_PER_SECTION) {
-        if (!pfn_present(pfn))
+        if (!pfn_to_section_present(pfn))
           continue;
       fail = init_section_page_ext(pfn, nid);
   }
mm/shuffle.c +1 -1
index b3fe97f..9242cc8 100644
@@ -72,7 +72,7 @@ static struct page * __meminit shuffle_valid_page(unsigned long pfn, int order)
       return NULL;
 
   /* ...is the pfn in a present section or a hole? */
-    if (!pfn_present(pfn))
+    if (!pfn_to_section_present(pfn))
       return NULL;
 
   /* ...is the page free and currently on a free_area list? */
Signature · 1 line
2.7.5
#2 lore raw
Quoted 8 lines · David Hildenbrand
Quoted 8 lines

Am 15.02.2020 um 07:19 schrieb Pingfan Liu <[email protected]>:

After introducing mem sub section concept, pfn_present() loses its literal meaning, and will not be necessary a truth on partial populated mem section.

Quoted 7 lines
Quoted 2 lines

Since all of the callers use it to judge an absent section, it is better to rename pfn_present() as pfn_to_section_present().

IMHO, the name is not any better.

pfn_in_present_section?

Yeah, that sounds better.

Thanks,
Pingfan

Quoted 103 lines

Cheers!

Quoted 100 lines
Cc Dan Williams <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc "Rafael J. Wysocki" <[email protected]>
Cc Andrew Morton <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc Leonardo Bras <[email protected]>
Cc Nathan Fontenot <[email protected]>
Cc Nathan Lynch <[email protected]>

To: [email protected]
---

arch/powerpc/platforms/pseries/hotplug-memory.c | 2 +-
drivers/base/node.c                             | 2 +-
include/linux/mmzone.h                          | 4 ++--
mm/page_ext.c                                   | 2 +-
mm/shuffle.c                                    | 2 +-
5 files changed, 6 insertions(+), 6 deletions(-)
arch/powerpc/platforms/pseries/hotplug-memory.c +1 -1
index a4d40a3..5088132 100644
@@ -360,7 +360,7 @@ static bool lmb_is_removable(struct drmem_lmb *lmb)
 
   for (i = 0; i < scns_per_block; i++) {
       pfn = PFN_DOWN(phys_addr);
-        if (!pfn_present(pfn)) {
+        if (!pfn_to_section_present(pfn)) {
           phys_addr += MIN_MEMORY_BLOCK_SIZE;
           continue;
       }
drivers/base/node.c +1 -1
index 98a31ba..6f98568 100644
@@ -772,7 +772,7 @@ static int register_mem_sect_under_node(struct memory_block *mem_blk,
        * memory block could have several absent sections from start.
        * skip pfn range from absent section
        */
-        if (!pfn_present(pfn)) {
+        if (!pfn_to_section_present(pfn)) {
           pfn = round_down(pfn + PAGES_PER_SECTION,
                    PAGES_PER_SECTION) - 1;
           continue;
include/linux/mmzone.h +2 -2
index 462f687..eca2db7 100644
@@ -1372,7 +1372,7 @@ static inline int pfn_valid(unsigned long pfn)
 }
 #endif
 
-static inline int pfn_present(unsigned long pfn)
+static inline int pfn_to_section_present(unsigned long pfn)
 {
   if (pfn_to_section_nr(pfn) >= NR_MEM_SECTIONS)
       return 0;
@@ -1409,7 +1409,7 @@ void sparse_init(void);
 #else
 #define sparse_init()    do {} while (0)
 #define sparse_index_init(_sec, _nid)  do {} while (0)
-#define pfn_present pfn_valid
+#define pfn_to_section_present pfn_valid
 #define subsection_map_init(_pfn, _nr_pages) do {} while (0)
 #endif /* CONFIG_SPARSEMEM */
 
mm/page_ext.c +1 -1
index 4ade843..df0e55e 100644
@@ -304,7 +304,7 @@ static int __meminit online_page_ext(unsigned long start_pfn,
   }
 
   for (pfn = start; !fail && pfn < end; pfn += PAGES_PER_SECTION) {
-        if (!pfn_present(pfn))
+        if (!pfn_to_section_present(pfn))
           continue;
       fail = init_section_page_ext(pfn, nid);
   }
mm/shuffle.c +1 -2
index b3fe97f..9242cc8 100644
@@ -72,7 +72,7 @@ static struct page * __meminit shuffle_valid_page(unsigned long pfn, int order)
       return NULL;
 
   /* ...is the pfn in a present section or a hole? */
-    if (!pfn_present(pfn))
+    if (!pfn_to_section_present(pfn))
       return NULL;
 
   /* ...is the page free and currently on a free_area list? */
--

2.7.5

#3 lore raw

PATCH v2 1/1 mm/sparse: rename pfn_present() as pfn_in_present_section()

After introducing mem sub section concept, pfn_present() loses its literal meaning, and will not be necessary a truth on partial populated mem section.

Since all of the callers use it to judge an absent section, it is better to rename pfn_present() as pfn_in_present_section().

Cc Dan Williams <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc "Rafael J. Wysocki" <[email protected]>
Cc Andrew Morton <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc Leonardo Bras <[email protected]>
Cc Nathan Fontenot <[email protected]>
Cc Nathan Lynch <[email protected]>

To: [email protected]
---
v1 -> v2: adopt David's suggestion, rename it as pfn_in_present_section()

 arch/powerpc/platforms/pseries/hotplug-memory.c | 2 +-
 drivers/base/node.c                             | 2 +-
 include/linux/mmzone.h                          | 4 ++--
 mm/page_ext.c                                   | 2 +-
 mm/shuffle.c                                    | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)
arch/powerpc/platforms/pseries/hotplug-memory.c +1 -1
index a4d40a3..f3ed1ba 100644
@@ -360,7 +360,7 @@ static bool lmb_is_removable(struct drmem_lmb *lmb)
 
 	for (i = 0; i < scns_per_block; i++) {
 		pfn = PFN_DOWN(phys_addr);
-		if (!pfn_present(pfn)) {
+		if (!pfn_in_present_section(pfn)) {
 			phys_addr += MIN_MEMORY_BLOCK_SIZE;
 			continue;
 		}
drivers/base/node.c +1 -1
index 98a31ba..10d7e81 100644
@@ -772,7 +772,7 @@ static int register_mem_sect_under_node(struct memory_block *mem_blk,
 		 * memory block could have several absent sections from start.
 		 * skip pfn range from absent section
 		 */
-		if (!pfn_present(pfn)) {
+		if (!pfn_in_present_section(pfn)) {
 			pfn = round_down(pfn + PAGES_PER_SECTION,
 					 PAGES_PER_SECTION) - 1;
 			continue;
include/linux/mmzone.h +2 -2
index 462f687..f6ceebdb 100644
@@ -1372,7 +1372,7 @@ static inline int pfn_valid(unsigned long pfn)
 }
 #endif
 
-static inline int pfn_present(unsigned long pfn)
+static inline int pfn_in_present_section(unsigned long pfn)
 {
 	if (pfn_to_section_nr(pfn) >= NR_MEM_SECTIONS)
 		return 0;
@@ -1409,7 +1409,7 @@ void sparse_init(void);
 #else
 #define sparse_init()	do {} while (0)
 #define sparse_index_init(_sec, _nid)  do {} while (0)
-#define pfn_present pfn_valid
+#define pfn_in_present_section pfn_valid
 #define subsection_map_init(_pfn, _nr_pages) do {} while (0)
 #endif /* CONFIG_SPARSEMEM */
 
mm/page_ext.c +1 -1
index 4ade843..08ded03 100644
@@ -304,7 +304,7 @@ static int __meminit online_page_ext(unsigned long start_pfn,
 	}
 
 	for (pfn = start; !fail && pfn < end; pfn += PAGES_PER_SECTION) {
-		if (!pfn_present(pfn))
+		if (!pfn_in_present_section(pfn))
 			continue;
 		fail = init_section_page_ext(pfn, nid);
 	}
mm/shuffle.c +1 -1
index b3fe97f..c716059 100644
@@ -72,7 +72,7 @@ static struct page * __meminit shuffle_valid_page(unsigned long pfn, int order)
 		return NULL;
 
 	/* ...is the pfn in a present section or a hole? */
-	if (!pfn_present(pfn))
+	if (!pfn_in_present_section(pfn))
 		return NULL;
 
 	/* ...is the page free and currently on a free_area list? */
Signature · 1 line
2.7.5
Reviewed-by on v2 1/1
#4 lore raw

Re: [PATCHv2] mm/sparse: rename pfn_present() as pfn_in_present_section()

Quoted 82 lines · Pingfan Liu

After introducing mem sub section concept, pfn_present() loses its literal meaning, and will not be necessary a truth on partial populated mem section.

Since all of the callers use it to judge an absent section, it is better to rename pfn_present() as pfn_in_present_section().

Cc Dan Williams <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc "Rafael J. Wysocki" <[email protected]>
Cc Andrew Morton <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc Leonardo Bras <[email protected]>
Cc Nathan Fontenot <[email protected]>
Cc Nathan Lynch <[email protected]>

To: [email protected]
---
v1 -> v2: adopt David's suggestion, rename it as pfn_in_present_section()

 arch/powerpc/platforms/pseries/hotplug-memory.c | 2 +-
 drivers/base/node.c                             | 2 +-
 include/linux/mmzone.h                          | 4 ++--
 mm/page_ext.c                                   | 2 +-
 mm/shuffle.c                                    | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)
arch/powerpc/platforms/pseries/hotplug-memory.c +1 -1
index a4d40a3..f3ed1ba 100644
@@ -360,7 +360,7 @@ static bool lmb_is_removable(struct drmem_lmb *lmb)
 
 	for (i = 0; i < scns_per_block; i++) {
 		pfn = PFN_DOWN(phys_addr);
-		if (!pfn_present(pfn)) {
+		if (!pfn_in_present_section(pfn)) {
 			phys_addr += MIN_MEMORY_BLOCK_SIZE;
 			continue;
 		}
drivers/base/node.c +1 -1
index 98a31ba..10d7e81 100644
@@ -772,7 +772,7 @@ static int register_mem_sect_under_node(struct memory_block *mem_blk,
 		 * memory block could have several absent sections from start.
 		 * skip pfn range from absent section
 		 */
-		if (!pfn_present(pfn)) {
+		if (!pfn_in_present_section(pfn)) {
 			pfn = round_down(pfn + PAGES_PER_SECTION,
 					 PAGES_PER_SECTION) - 1;
 			continue;
include/linux/mmzone.h +2 -2
index 462f687..f6ceebdb 100644
@@ -1372,7 +1372,7 @@ static inline int pfn_valid(unsigned long pfn)
 }
 #endif
 
-static inline int pfn_present(unsigned long pfn)
+static inline int pfn_in_present_section(unsigned long pfn)
 {
 	if (pfn_to_section_nr(pfn) >= NR_MEM_SECTIONS)
 		return 0;
@@ -1409,7 +1409,7 @@ void sparse_init(void);
 #else
 #define sparse_init()	do {} while (0)
 #define sparse_index_init(_sec, _nid)  do {} while (0)
-#define pfn_present pfn_valid
+#define pfn_in_present_section pfn_valid
 #define subsection_map_init(_pfn, _nr_pages) do {} while (0)
 #endif /* CONFIG_SPARSEMEM */
 
mm/page_ext.c +0 -0
index 4ade843..08ded03 100644

mm/page_ext.c static int __meminit online_page_ext(unsigned long start_pfn, · line 308

Quoted 6 lines
mm/page_ext.c +1 -1
@@ -304,7 +304,7 @@ static int __meminit online_page_ext(unsigned long start_pfn,
 	}
 
 	for (pfn = start; !fail && pfn < end; pfn += PAGES_PER_SECTION) {
-		if (!pfn_present(pfn))
+		if (!pfn_in_present_section(pfn))
 			continue;

This check should be gone in -next already.

Signature · 3 lines
Thanks,

David / dhildenb
reviewer Acked-by on v2 1/1
#5 lore raw

Re: [PATCHv2] mm/sparse: rename pfn_present() as pfn_in_present_section()

In reply to Pingfan Liu
Quoted 34 lines · Pingfan Liu

After introducing mem sub section concept, pfn_present() loses its literal meaning, and will not be necessary a truth on partial populated mem section.

Since all of the callers use it to judge an absent section, it is better to rename pfn_present() as pfn_in_present_section().

Cc Dan Williams <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc "Rafael J. Wysocki" <[email protected]>
Cc Andrew Morton <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc Leonardo Bras <[email protected]>
Cc Nathan Fontenot <[email protected]>
Cc Nathan Lynch <[email protected]>

To: [email protected]
---
v1 -> v2: adopt David's suggestion, rename it as pfn_in_present_section()

 arch/powerpc/platforms/pseries/hotplug-memory.c | 2 +-
 drivers/base/node.c                             | 2 +-
 include/linux/mmzone.h                          | 4 ++--
 mm/page_ext.c                                   | 2 +-
 mm/shuffle.c                                    | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)
arch/powerpc/platforms/pseries/hotplug-memory.c +0 -0
index a4d40a3..f3ed1ba 100644

arch/powerpc/platforms/pseries/hotplug-memory.c static bool lmb_is_removable(struct drmem_lmb *lmb) · line 366

Quoted 8 lines
arch/powerpc/platforms/pseries/hotplug-memory.c +1 -1
@@ -360,7 +360,7 @@ static bool lmb_is_removable(struct drmem_lmb *lmb)
 
 	for (i = 0; i < scns_per_block; i++) {
 		pfn = PFN_DOWN(phys_addr);
-		if (!pfn_present(pfn)) {
+		if (!pfn_in_present_section(pfn)) {
 			phys_addr += MIN_MEMORY_BLOCK_SIZE;
 			continue;
 		}

Fine by me:

cheers