linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/sparse: rename pfn_present() as pfn_to_section_present()
@ 2020-02-15  6:17 Pingfan Liu
  2020-02-15 12:59 ` David Hildenbrand
  0 siblings, 1 reply; 6+ messages in thread
From: Pingfan Liu @ 2020-02-15  6:17 UTC (permalink / raw)
  To: linux-mm
  Cc: Pingfan Liu, Dan Williams, Michal Hocko, Benjamin Herrenschmidt,
	Paul Mackerras, Michael Ellerman, Greg Kroah-Hartman,
	Rafael J. Wysocki, Andrew Morton, David Hildenbrand,
	Leonardo Bras, Nathan Fontenot, Nathan Lynch

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().

Signed-off-by: Pingfan Liu <kernelfans@gmail.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: David Hildenbrand <david@redhat.com>
Cc: Leonardo Bras <leonardo@linux.ibm.com>
Cc: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Cc: Nathan Lynch <nathanl@linux.ibm.com>
To: linux-mm@kvack.org
---
 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(-)

diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
index a4d40a3..5088132 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -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;
 		}
diff --git a/drivers/base/node.c b/drivers/base/node.c
index 98a31ba..6f98568 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -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;
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 462f687..eca2db7 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -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 */
 
diff --git a/mm/page_ext.c b/mm/page_ext.c
index 4ade843..df0e55e 100644
--- a/mm/page_ext.c
+++ b/mm/page_ext.c
@@ -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);
 	}
diff --git a/mm/shuffle.c b/mm/shuffle.c
index b3fe97f..9242cc8 100644
--- a/mm/shuffle.c
+++ b/mm/shuffle.c
@@ -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



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] mm/sparse: rename pfn_present() as pfn_to_section_present()
  2020-02-15  6:17 [PATCH] mm/sparse: rename pfn_present() as pfn_to_section_present() Pingfan Liu
@ 2020-02-15 12:59 ` David Hildenbrand
  2020-02-17  3:22   ` Pingfan Liu
  0 siblings, 1 reply; 6+ messages in thread
From: David Hildenbrand @ 2020-02-15 12:59 UTC (permalink / raw)
  To: Pingfan Liu
  Cc: linux-mm, Dan Williams, Michal Hocko, Benjamin Herrenschmidt,
	Paul Mackerras, Michael Ellerman, Greg Kroah-Hartman,
	Rafael J. Wysocki, Andrew Morton, David Hildenbrand,
	Leonardo Bras, Nathan Fontenot, Nathan Lynch



> Am 15.02.2020 um 07:19 schrieb Pingfan Liu <kernelfans@gmail.com>:
> 
> 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!

> 
> Signed-off-by: Pingfan Liu <kernelfans@gmail.com>
> Cc: Dan Williams <dan.j.williams@intel.com>
> Cc: Michal Hocko <mhocko@kernel.org>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: David Hildenbrand <david@redhat.com>
> Cc: Leonardo Bras <leonardo@linux.ibm.com>
> Cc: Nathan Fontenot <nfont@linux.vnet.ibm.com>
> Cc: Nathan Lynch <nathanl@linux.ibm.com>
> To: linux-mm@kvack.org
> ---
> 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(-)
> 
> diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
> index a4d40a3..5088132 100644
> --- a/arch/powerpc/platforms/pseries/hotplug-memory.c
> +++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
> @@ -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;
>        }
> diff --git a/drivers/base/node.c b/drivers/base/node.c
> index 98a31ba..6f98568 100644
> --- a/drivers/base/node.c
> +++ b/drivers/base/node.c
> @@ -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;
> diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
> index 462f687..eca2db7 100644
> --- a/include/linux/mmzone.h
> +++ b/include/linux/mmzone.h
> @@ -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 */
> 
> diff --git a/mm/page_ext.c b/mm/page_ext.c
> index 4ade843..df0e55e 100644
> --- a/mm/page_ext.c
> +++ b/mm/page_ext.c
> @@ -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);
>    }
> diff --git a/mm/shuffle.c b/mm/shuffle.c
> index b3fe97f..9242cc8 100644
> --- a/mm/shuffle.c
> +++ b/mm/shuffle.c
> @@ -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
> 



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mm/sparse: rename pfn_present() as pfn_to_section_present()
  2020-02-15 12:59 ` David Hildenbrand
@ 2020-02-17  3:22   ` Pingfan Liu
  2020-02-17  5:58     ` [PATCHv2] mm/sparse: rename pfn_present() as pfn_in_present_section() Pingfan Liu
  0 siblings, 1 reply; 6+ messages in thread
From: Pingfan Liu @ 2020-02-17  3:22 UTC (permalink / raw)
  To: David Hildenbrand
  Cc: Linux-MM, Dan Williams, Michal Hocko, Benjamin Herrenschmidt,
	Paul Mackerras, Michael Ellerman, Greg Kroah-Hartman,
	Rafael J. Wysocki, Andrew Morton, Leonardo Bras, Nathan Fontenot,
	Nathan Lynch

On Sat, Feb 15, 2020 at 8:59 PM David Hildenbrand <david@redhat.com> wrote:
>
>
>
> > Am 15.02.2020 um 07:19 schrieb Pingfan Liu <kernelfans@gmail.com>:
> >
> > 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?
>
Yeah, that sounds better.

Thanks,
Pingfan
> Cheers!
>
> >
> > Signed-off-by: Pingfan Liu <kernelfans@gmail.com>
> > Cc: Dan Williams <dan.j.williams@intel.com>
> > Cc: Michal Hocko <mhocko@kernel.org>
> > Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> > Cc: Paul Mackerras <paulus@samba.org>
> > Cc: Michael Ellerman <mpe@ellerman.id.au>
> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> > Cc: Andrew Morton <akpm@linux-foundation.org>
> > Cc: David Hildenbrand <david@redhat.com>
> > Cc: Leonardo Bras <leonardo@linux.ibm.com>
> > Cc: Nathan Fontenot <nfont@linux.vnet.ibm.com>
> > Cc: Nathan Lynch <nathanl@linux.ibm.com>
> > To: linux-mm@kvack.org
> > ---
> > 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(-)
> >
> > diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
> > index a4d40a3..5088132 100644
> > --- a/arch/powerpc/platforms/pseries/hotplug-memory.c
> > +++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
> > @@ -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;
> >        }
> > diff --git a/drivers/base/node.c b/drivers/base/node.c
> > index 98a31ba..6f98568 100644
> > --- a/drivers/base/node.c
> > +++ b/drivers/base/node.c
> > @@ -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;
> > diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
> > index 462f687..eca2db7 100644
> > --- a/include/linux/mmzone.h
> > +++ b/include/linux/mmzone.h
> > @@ -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 */
> >
> > diff --git a/mm/page_ext.c b/mm/page_ext.c
> > index 4ade843..df0e55e 100644
> > --- a/mm/page_ext.c
> > +++ b/mm/page_ext.c
> > @@ -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);
> >    }
> > diff --git a/mm/shuffle.c b/mm/shuffle.c
> > index b3fe97f..9242cc8 100644
> > --- a/mm/shuffle.c
> > +++ b/mm/shuffle.c
> > @@ -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
> >
>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCHv2] mm/sparse: rename pfn_present() as pfn_in_present_section()
  2020-02-17  3:22   ` Pingfan Liu
@ 2020-02-17  5:58     ` Pingfan Liu
  2020-02-17 10:01       ` David Hildenbrand
  2020-02-18 11:34       ` Michael Ellerman
  0 siblings, 2 replies; 6+ messages in thread
From: Pingfan Liu @ 2020-02-17  5:58 UTC (permalink / raw)
  To: linux-mm
  Cc: Pingfan Liu, Dan Williams, Michal Hocko, Benjamin Herrenschmidt,
	Paul Mackerras, Michael Ellerman, Greg Kroah-Hartman,
	Rafael J. Wysocki, Andrew Morton, David Hildenbrand,
	Leonardo Bras, Nathan Fontenot, Nathan Lynch

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().

Signed-off-by: Pingfan Liu <kernelfans@gmail.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: David Hildenbrand <david@redhat.com>
Cc: Leonardo Bras <leonardo@linux.ibm.com>
Cc: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Cc: Nathan Lynch <nathanl@linux.ibm.com>
To: linux-mm@kvack.org
---
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(-)

diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
index a4d40a3..f3ed1ba 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -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;
 		}
diff --git a/drivers/base/node.c b/drivers/base/node.c
index 98a31ba..10d7e81 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -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;
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 462f687..f6ceebdb 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -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 */
 
diff --git a/mm/page_ext.c b/mm/page_ext.c
index 4ade843..08ded03 100644
--- a/mm/page_ext.c
+++ b/mm/page_ext.c
@@ -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);
 	}
diff --git a/mm/shuffle.c b/mm/shuffle.c
index b3fe97f..c716059 100644
--- a/mm/shuffle.c
+++ b/mm/shuffle.c
@@ -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? */
-- 
2.7.5



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCHv2] mm/sparse: rename pfn_present() as pfn_in_present_section()
  2020-02-17  5:58     ` [PATCHv2] mm/sparse: rename pfn_present() as pfn_in_present_section() Pingfan Liu
@ 2020-02-17 10:01       ` David Hildenbrand
  2020-02-18 11:34       ` Michael Ellerman
  1 sibling, 0 replies; 6+ messages in thread
From: David Hildenbrand @ 2020-02-17 10:01 UTC (permalink / raw)
  To: Pingfan Liu, linux-mm
  Cc: Dan Williams, Michal Hocko, Benjamin Herrenschmidt,
	Paul Mackerras, Michael Ellerman, Greg Kroah-Hartman,
	Rafael J. Wysocki, Andrew Morton, Leonardo Bras, Nathan Fontenot,
	Nathan Lynch

On 17.02.20 06:58, Pingfan Liu wrote:
> 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().
> 
> Signed-off-by: Pingfan Liu <kernelfans@gmail.com>
> Cc: Dan Williams <dan.j.williams@intel.com>
> Cc: Michal Hocko <mhocko@kernel.org>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: David Hildenbrand <david@redhat.com>
> Cc: Leonardo Bras <leonardo@linux.ibm.com>
> Cc: Nathan Fontenot <nfont@linux.vnet.ibm.com>
> Cc: Nathan Lynch <nathanl@linux.ibm.com>
> To: linux-mm@kvack.org
> ---
> 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(-)
> 
> diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
> index a4d40a3..f3ed1ba 100644
> --- a/arch/powerpc/platforms/pseries/hotplug-memory.c
> +++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
> @@ -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;
>  		}
> diff --git a/drivers/base/node.c b/drivers/base/node.c
> index 98a31ba..10d7e81 100644
> --- a/drivers/base/node.c
> +++ b/drivers/base/node.c
> @@ -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;
> diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
> index 462f687..f6ceebdb 100644
> --- a/include/linux/mmzone.h
> +++ b/include/linux/mmzone.h
> @@ -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 */
>  
> diff --git a/mm/page_ext.c b/mm/page_ext.c
> index 4ade843..08ded03 100644
> --- a/mm/page_ext.c
> +++ b/mm/page_ext.c
> @@ -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.


Reviewed-by: David Hildenbrand <david@redhat.com>


-- 
Thanks,

David / dhildenb



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCHv2] mm/sparse: rename pfn_present() as pfn_in_present_section()
  2020-02-17  5:58     ` [PATCHv2] mm/sparse: rename pfn_present() as pfn_in_present_section() Pingfan Liu
  2020-02-17 10:01       ` David Hildenbrand
@ 2020-02-18 11:34       ` Michael Ellerman
  1 sibling, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2020-02-18 11:34 UTC (permalink / raw)
  To: Pingfan Liu, linux-mm
  Cc: Pingfan Liu, Dan Williams, Michal Hocko, Benjamin Herrenschmidt,
	Paul Mackerras, Greg Kroah-Hartman, Rafael J. Wysocki,
	Andrew Morton, David Hildenbrand, Leonardo Bras, Nathan Fontenot,
	Nathan Lynch

Pingfan Liu <kernelfans@gmail.com> writes:
> 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().
>
> Signed-off-by: Pingfan Liu <kernelfans@gmail.com>
> Cc: Dan Williams <dan.j.williams@intel.com>
> Cc: Michal Hocko <mhocko@kernel.org>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: David Hildenbrand <david@redhat.com>
> Cc: Leonardo Bras <leonardo@linux.ibm.com>
> Cc: Nathan Fontenot <nfont@linux.vnet.ibm.com>
> Cc: Nathan Lynch <nathanl@linux.ibm.com>
> To: linux-mm@kvack.org
> ---
> 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(-)
>
> diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
> index a4d40a3..f3ed1ba 100644
> --- a/arch/powerpc/platforms/pseries/hotplug-memory.c
> +++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
> @@ -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:

Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)

cheers


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-02-18 11:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-15  6:17 [PATCH] mm/sparse: rename pfn_present() as pfn_to_section_present() Pingfan Liu
2020-02-15 12:59 ` David Hildenbrand
2020-02-17  3:22   ` Pingfan Liu
2020-02-17  5:58     ` [PATCHv2] mm/sparse: rename pfn_present() as pfn_in_present_section() Pingfan Liu
2020-02-17 10:01       ` David Hildenbrand
2020-02-18 11:34       ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).