linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] mm/memory_hotplug: remove reset_node_managed_pages() in hotadd_init_pgdat()
       [not found] <f125f0db-30fe-5452-4669-3e48f7856569@redhat.com>
@ 2023-06-07  2:45 ` Haifeng Xu
  2023-06-07 10:27   ` Michal Hocko
                     ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Haifeng Xu @ 2023-06-07  2:45 UTC (permalink / raw)
  To: david; +Cc: rppt, mhocko, osalvador, akpm, linux-mm, linux-kernel, Haifeng Xu

managed pages has already been set to 0 in free_area_init_core_hotplug(),
via zone_init_internals() on each zone. It's pointless to reset again.

Furthermore, reset_node_managed_pages() no longer needs to be exposed
outside of mm/memblock.c. Remove declaration in include/linux/memblock.h
and define it as static.

In addtion to this, the only caller of reset_node_managed_pages() is
reset_all_zones_managed_pages(), which is annotated with __init, so it
should be safe to also mark reset_node_managed_pages() as __init.

Signed-off-by: Haifeng Xu <haifeng.xu@shopee.com>
Suggested-by: David Hildenbrand <david@redhat.com>
---
v2:
- unexport reset_node_managed_pages()
- mark reset_node_managed_pages() as __init
- update commit message
---
 include/linux/memblock.h | 1 -
 mm/memblock.c            | 2 +-
 mm/memory_hotplug.c      | 1 -
 3 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index f82ee3fac1cd..f71ff9f0ec81 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -128,7 +128,6 @@ int memblock_clear_nomap(phys_addr_t base, phys_addr_t size);
 
 void memblock_free_all(void);
 void memblock_free(void *ptr, size_t size);
-void reset_node_managed_pages(pg_data_t *pgdat);
 void reset_all_zones_managed_pages(void);
 
 /* Low level functions */
diff --git a/mm/memblock.c b/mm/memblock.c
index 3feafea06ab2..da4264528e1e 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -2122,7 +2122,7 @@ static unsigned long __init free_low_memory_core_early(void)
 
 static int reset_managed_pages_done __initdata;
 
-void reset_node_managed_pages(pg_data_t *pgdat)
+static void __init reset_node_managed_pages(pg_data_t *pgdat)
 {
 	struct zone *z;
 
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 8e0fa209d533..65e385f34679 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1210,7 +1210,6 @@ static pg_data_t __ref *hotadd_init_pgdat(int nid)
 	 * online_pages() and offline_pages().
 	 * TODO: should be in free_area_init_core_hotplug?
 	 */
-	reset_node_managed_pages(pgdat);
 	reset_node_present_pages(pgdat);
 
 	return pgdat;
-- 
2.25.1



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

* Re: [PATCH v2 1/2] mm/memory_hotplug: remove reset_node_managed_pages() in hotadd_init_pgdat()
  2023-06-07  2:45 ` [PATCH v2 1/2] mm/memory_hotplug: remove reset_node_managed_pages() in hotadd_init_pgdat() Haifeng Xu
@ 2023-06-07 10:27   ` Michal Hocko
  2023-06-07 11:23   ` Mike Rapoport
  2023-06-07 11:37   ` David Hildenbrand
  2 siblings, 0 replies; 4+ messages in thread
From: Michal Hocko @ 2023-06-07 10:27 UTC (permalink / raw)
  To: Haifeng Xu; +Cc: david, rppt, osalvador, akpm, linux-mm, linux-kernel

On Wed 07-06-23 02:45:48, Haifeng Xu wrote:
> managed pages has already been set to 0 in free_area_init_core_hotplug(),
> via zone_init_internals() on each zone. It's pointless to reset again.
> 
> Furthermore, reset_node_managed_pages() no longer needs to be exposed
> outside of mm/memblock.c. Remove declaration in include/linux/memblock.h
> and define it as static.
> 
> In addtion to this, the only caller of reset_node_managed_pages() is
> reset_all_zones_managed_pages(), which is annotated with __init, so it
> should be safe to also mark reset_node_managed_pages() as __init.
> 
> Signed-off-by: Haifeng Xu <haifeng.xu@shopee.com>
> Suggested-by: David Hildenbrand <david@redhat.com>

Acked-by: Michal Hocko <mhocko@suse.com>

> ---
> v2:
> - unexport reset_node_managed_pages()
> - mark reset_node_managed_pages() as __init
> - update commit message
> ---
>  include/linux/memblock.h | 1 -
>  mm/memblock.c            | 2 +-
>  mm/memory_hotplug.c      | 1 -
>  3 files changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/include/linux/memblock.h b/include/linux/memblock.h
> index f82ee3fac1cd..f71ff9f0ec81 100644
> --- a/include/linux/memblock.h
> +++ b/include/linux/memblock.h
> @@ -128,7 +128,6 @@ int memblock_clear_nomap(phys_addr_t base, phys_addr_t size);
>  
>  void memblock_free_all(void);
>  void memblock_free(void *ptr, size_t size);
> -void reset_node_managed_pages(pg_data_t *pgdat);
>  void reset_all_zones_managed_pages(void);
>  
>  /* Low level functions */
> diff --git a/mm/memblock.c b/mm/memblock.c
> index 3feafea06ab2..da4264528e1e 100644
> --- a/mm/memblock.c
> +++ b/mm/memblock.c
> @@ -2122,7 +2122,7 @@ static unsigned long __init free_low_memory_core_early(void)
>  
>  static int reset_managed_pages_done __initdata;
>  
> -void reset_node_managed_pages(pg_data_t *pgdat)
> +static void __init reset_node_managed_pages(pg_data_t *pgdat)
>  {
>  	struct zone *z;
>  
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 8e0fa209d533..65e385f34679 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -1210,7 +1210,6 @@ static pg_data_t __ref *hotadd_init_pgdat(int nid)
>  	 * online_pages() and offline_pages().
>  	 * TODO: should be in free_area_init_core_hotplug?
>  	 */
> -	reset_node_managed_pages(pgdat);
>  	reset_node_present_pages(pgdat);
>  
>  	return pgdat;
> -- 
> 2.25.1

-- 
Michal Hocko
SUSE Labs


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

* Re: [PATCH v2 1/2] mm/memory_hotplug: remove reset_node_managed_pages() in hotadd_init_pgdat()
  2023-06-07  2:45 ` [PATCH v2 1/2] mm/memory_hotplug: remove reset_node_managed_pages() in hotadd_init_pgdat() Haifeng Xu
  2023-06-07 10:27   ` Michal Hocko
@ 2023-06-07 11:23   ` Mike Rapoport
  2023-06-07 11:37   ` David Hildenbrand
  2 siblings, 0 replies; 4+ messages in thread
From: Mike Rapoport @ 2023-06-07 11:23 UTC (permalink / raw)
  To: Haifeng Xu; +Cc: david, mhocko, osalvador, akpm, linux-mm, linux-kernel

On Wed, Jun 07, 2023 at 02:45:48AM +0000, Haifeng Xu wrote:
> managed pages has already been set to 0 in free_area_init_core_hotplug(),
> via zone_init_internals() on each zone. It's pointless to reset again.
> 
> Furthermore, reset_node_managed_pages() no longer needs to be exposed
> outside of mm/memblock.c. Remove declaration in include/linux/memblock.h
> and define it as static.
> 
> In addtion to this, the only caller of reset_node_managed_pages() is
> reset_all_zones_managed_pages(), which is annotated with __init, so it
> should be safe to also mark reset_node_managed_pages() as __init.
> 
> Signed-off-by: Haifeng Xu <haifeng.xu@shopee.com>
> Suggested-by: David Hildenbrand <david@redhat.com>

Acked-by: Mike Rapoport (IBM) <rppt@kernel.org>

> ---
> v2:
> - unexport reset_node_managed_pages()
> - mark reset_node_managed_pages() as __init
> - update commit message
> ---
>  include/linux/memblock.h | 1 -
>  mm/memblock.c            | 2 +-
>  mm/memory_hotplug.c      | 1 -
>  3 files changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/include/linux/memblock.h b/include/linux/memblock.h
> index f82ee3fac1cd..f71ff9f0ec81 100644
> --- a/include/linux/memblock.h
> +++ b/include/linux/memblock.h
> @@ -128,7 +128,6 @@ int memblock_clear_nomap(phys_addr_t base, phys_addr_t size);
>  
>  void memblock_free_all(void);
>  void memblock_free(void *ptr, size_t size);
> -void reset_node_managed_pages(pg_data_t *pgdat);
>  void reset_all_zones_managed_pages(void);
>  
>  /* Low level functions */
> diff --git a/mm/memblock.c b/mm/memblock.c
> index 3feafea06ab2..da4264528e1e 100644
> --- a/mm/memblock.c
> +++ b/mm/memblock.c
> @@ -2122,7 +2122,7 @@ static unsigned long __init free_low_memory_core_early(void)
>  
>  static int reset_managed_pages_done __initdata;
>  
> -void reset_node_managed_pages(pg_data_t *pgdat)
> +static void __init reset_node_managed_pages(pg_data_t *pgdat)
>  {
>  	struct zone *z;
>  
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 8e0fa209d533..65e385f34679 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -1210,7 +1210,6 @@ static pg_data_t __ref *hotadd_init_pgdat(int nid)
>  	 * online_pages() and offline_pages().
>  	 * TODO: should be in free_area_init_core_hotplug?
>  	 */
> -	reset_node_managed_pages(pgdat);
>  	reset_node_present_pages(pgdat);
>  
>  	return pgdat;
> -- 
> 2.25.1
> 

-- 
Sincerely yours,
Mike.


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

* Re: [PATCH v2 1/2] mm/memory_hotplug: remove reset_node_managed_pages() in hotadd_init_pgdat()
  2023-06-07  2:45 ` [PATCH v2 1/2] mm/memory_hotplug: remove reset_node_managed_pages() in hotadd_init_pgdat() Haifeng Xu
  2023-06-07 10:27   ` Michal Hocko
  2023-06-07 11:23   ` Mike Rapoport
@ 2023-06-07 11:37   ` David Hildenbrand
  2 siblings, 0 replies; 4+ messages in thread
From: David Hildenbrand @ 2023-06-07 11:37 UTC (permalink / raw)
  To: Haifeng Xu; +Cc: rppt, mhocko, osalvador, akpm, linux-mm, linux-kernel

On 07.06.23 04:45, Haifeng Xu wrote:
> managed pages has already been set to 0 in free_area_init_core_hotplug(),
> via zone_init_internals() on each zone. It's pointless to reset again.
> 
> Furthermore, reset_node_managed_pages() no longer needs to be exposed
> outside of mm/memblock.c. Remove declaration in include/linux/memblock.h
> and define it as static.
> 
> In addtion to this, the only caller of reset_node_managed_pages() is
> reset_all_zones_managed_pages(), which is annotated with __init, so it
> should be safe to also mark reset_node_managed_pages() as __init.
> 
> Signed-off-by: Haifeng Xu <haifeng.xu@shopee.com>
> Suggested-by: David Hildenbrand <david@redhat.com>
> ---
> v2:
> - unexport reset_node_managed_pages()
> - mark reset_node_managed_pages() as __init
> - update commit message
> ---
>   include/linux/memblock.h | 1 -
>   mm/memblock.c            | 2 +-
>   mm/memory_hotplug.c      | 1 -
>   3 files changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/include/linux/memblock.h b/include/linux/memblock.h
> index f82ee3fac1cd..f71ff9f0ec81 100644
> --- a/include/linux/memblock.h
> +++ b/include/linux/memblock.h
> @@ -128,7 +128,6 @@ int memblock_clear_nomap(phys_addr_t base, phys_addr_t size);
>   
>   void memblock_free_all(void);
>   void memblock_free(void *ptr, size_t size);
> -void reset_node_managed_pages(pg_data_t *pgdat);
>   void reset_all_zones_managed_pages(void);
>   
>   /* Low level functions */
> diff --git a/mm/memblock.c b/mm/memblock.c
> index 3feafea06ab2..da4264528e1e 100644
> --- a/mm/memblock.c
> +++ b/mm/memblock.c
> @@ -2122,7 +2122,7 @@ static unsigned long __init free_low_memory_core_early(void)
>   
>   static int reset_managed_pages_done __initdata;
>   
> -void reset_node_managed_pages(pg_data_t *pgdat)
> +static void __init reset_node_managed_pages(pg_data_t *pgdat)
>   {
>   	struct zone *z;
>   
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 8e0fa209d533..65e385f34679 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -1210,7 +1210,6 @@ static pg_data_t __ref *hotadd_init_pgdat(int nid)
>   	 * online_pages() and offline_pages().
>   	 * TODO: should be in free_area_init_core_hotplug?
>   	 */
> -	reset_node_managed_pages(pgdat);
>   	reset_node_present_pages(pgdat);
>   
>   	return pgdat;

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

-- 
Cheers,

David / dhildenb



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

end of thread, other threads:[~2023-06-07 11:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <f125f0db-30fe-5452-4669-3e48f7856569@redhat.com>
2023-06-07  2:45 ` [PATCH v2 1/2] mm/memory_hotplug: remove reset_node_managed_pages() in hotadd_init_pgdat() Haifeng Xu
2023-06-07 10:27   ` Michal Hocko
2023-06-07 11:23   ` Mike Rapoport
2023-06-07 11:37   ` David Hildenbrand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox