mm/sparse: rename pfn_present() as pfn_to_section_present()
Subsystems (6)
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().
--- 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
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()aspfn_to_section_present().
IMHO, the name is not any better.
pfn_in_present_section?
Cheers!
Quoted 100 lines
Signed-off-by Pingfan Liu <[email protected]>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@@ -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@@ -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@@ -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@@ -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@@ -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
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()aspfn_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
Signed-off-by Pingfan Liu <[email protected]>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@@ -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@@ -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@@ -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@@ -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@@ -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
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().
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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
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()aspfn_in_present_section().Signed-off-by Pingfan Liu <[email protected]>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 aspfn_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@@ -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@@ -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@@ -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
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
Re: [PATCHv2] mm/sparse: rename pfn_present() as pfn_in_present_section()
In reply to Pingfan LiuQuoted 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()aspfn_in_present_section().Signed-off-by Pingfan Liu <[email protected]>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 aspfn_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
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