linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: remove unused function inc_node_state()
@ 2025-12-25  1:54 Wei Yang
  2025-12-25  7:52 ` Joshua Hahn
  2025-12-30 20:48 ` David Hildenbrand (Red Hat)
  0 siblings, 2 replies; 4+ messages in thread
From: Wei Yang @ 2025-12-25  1:54 UTC (permalink / raw)
  To: akpm, david, lorenzo.stoakes, Liam.Howlett, vbabka, rppt, surenb, mhocko
  Cc: linux-mm, Wei Yang

The function inc_node_state() is no longer utilized by any part of the
kernel.

This commit removes the dead code.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
---
 include/linux/vmstat.h |  2 --
 mm/vmstat.c            | 15 ---------------
 2 files changed, 17 deletions(-)

diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index 3398a345bda8..864a78287371 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -286,7 +286,6 @@ void mod_node_page_state(struct pglist_data *, enum node_stat_item, long);
 void inc_node_page_state(struct page *, enum node_stat_item);
 void dec_node_page_state(struct page *, enum node_stat_item);
 
-extern void inc_node_state(struct pglist_data *, enum node_stat_item);
 extern void __inc_zone_state(struct zone *, enum zone_stat_item);
 extern void __inc_node_state(struct pglist_data *, enum node_stat_item);
 extern void dec_zone_state(struct zone *, enum zone_stat_item);
@@ -395,7 +394,6 @@ static inline void __dec_node_page_state(struct page *page,
 #define mod_node_page_state __mod_node_page_state
 
 #define inc_zone_state __inc_zone_state
-#define inc_node_state __inc_node_state
 #define dec_zone_state __dec_zone_state
 
 #define set_pgdat_percpu_threshold(pgdat, callback) { }
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 090b5c5294b9..16b7cb24d411 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -671,11 +671,6 @@ void mod_node_page_state(struct pglist_data *pgdat, enum node_stat_item item,
 }
 EXPORT_SYMBOL(mod_node_page_state);
 
-void inc_node_state(struct pglist_data *pgdat, enum node_stat_item item)
-{
-	mod_node_state(pgdat, item, 1, 1);
-}
-
 void inc_node_page_state(struct page *page, enum node_stat_item item)
 {
 	mod_node_state(page_pgdat(page), item, 1, 1);
@@ -724,16 +719,6 @@ void dec_zone_page_state(struct page *page, enum zone_stat_item item)
 }
 EXPORT_SYMBOL(dec_zone_page_state);
 
-void inc_node_state(struct pglist_data *pgdat, enum node_stat_item item)
-{
-	unsigned long flags;
-
-	local_irq_save(flags);
-	__inc_node_state(pgdat, item);
-	local_irq_restore(flags);
-}
-EXPORT_SYMBOL(inc_node_state);
-
 void mod_node_page_state(struct pglist_data *pgdat, enum node_stat_item item,
 					long delta)
 {
-- 
2.34.1



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

* Re: [PATCH] mm: remove unused function inc_node_state()
  2025-12-25  1:54 [PATCH] mm: remove unused function inc_node_state() Wei Yang
@ 2025-12-25  7:52 ` Joshua Hahn
  2025-12-25 14:24   ` Wei Yang
  2025-12-30 20:48 ` David Hildenbrand (Red Hat)
  1 sibling, 1 reply; 4+ messages in thread
From: Joshua Hahn @ 2025-12-25  7:52 UTC (permalink / raw)
  To: Wei Yang
  Cc: akpm, david, lorenzo.stoakes, Liam.Howlett, vbabka, rppt, surenb,
	mhocko, linux-mm

On Thu, 25 Dec 2025 01:54:45 +0000 Wei Yang <richard.weiyang@gmail.com> wrote:

> The function inc_node_state() is no longer utilized by any part of the
> kernel.
> 
> This commit removes the dead code.
> 
> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>

Hello Wei,

Thank you for this patch! AFAICT it seems like the last users were removed
all the way back in 2017, in 00f3ca2c2d66 ("mm: memcontrol: per-lruvec stats
infrastructure"). 

Maybe outside of the scope of this patch, but I think it might be a good
opportunity to also remove dec_zone_state and inc_zone_state as well since
they are right next to the functions you just remoted : -)

(Interestingly, dec_node_state does not exist already).

Thanks again! This patch looks good to me as-is, but please feel free to
also remove the two functions above if that sounds reasonable to you.

Have a great day!
Reviewed-by: Joshua Hahn <joshua.hahnjy@gmail.com>

> ---
>  include/linux/vmstat.h |  2 --
>  mm/vmstat.c            | 15 ---------------
>  2 files changed, 17 deletions(-)
> 
> diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
> index 3398a345bda8..864a78287371 100644
> --- a/include/linux/vmstat.h
> +++ b/include/linux/vmstat.h
> @@ -286,7 +286,6 @@ void mod_node_page_state(struct pglist_data *, enum node_stat_item, long);
>  void inc_node_page_state(struct page *, enum node_stat_item);
>  void dec_node_page_state(struct page *, enum node_stat_item);
>  
> -extern void inc_node_state(struct pglist_data *, enum node_stat_item);
>  extern void __inc_zone_state(struct zone *, enum zone_stat_item);
>  extern void __inc_node_state(struct pglist_data *, enum node_stat_item);
>  extern void dec_zone_state(struct zone *, enum zone_stat_item);
> @@ -395,7 +394,6 @@ static inline void __dec_node_page_state(struct page *page,
>  #define mod_node_page_state __mod_node_page_state
>  
>  #define inc_zone_state __inc_zone_state
> -#define inc_node_state __inc_node_state
>  #define dec_zone_state __dec_zone_state
>  
>  #define set_pgdat_percpu_threshold(pgdat, callback) { }
> diff --git a/mm/vmstat.c b/mm/vmstat.c
> index 090b5c5294b9..16b7cb24d411 100644
> --- a/mm/vmstat.c
> +++ b/mm/vmstat.c
> @@ -671,11 +671,6 @@ void mod_node_page_state(struct pglist_data *pgdat, enum node_stat_item item,
>  }
>  EXPORT_SYMBOL(mod_node_page_state);
>  
> -void inc_node_state(struct pglist_data *pgdat, enum node_stat_item item)
> -{
> -	mod_node_state(pgdat, item, 1, 1);
> -}
> -
>  void inc_node_page_state(struct page *page, enum node_stat_item item)
>  {
>  	mod_node_state(page_pgdat(page), item, 1, 1);
> @@ -724,16 +719,6 @@ void dec_zone_page_state(struct page *page, enum zone_stat_item item)
>  }
>  EXPORT_SYMBOL(dec_zone_page_state);
>  
> -void inc_node_state(struct pglist_data *pgdat, enum node_stat_item item)
> -{
> -	unsigned long flags;
> -
> -	local_irq_save(flags);
> -	__inc_node_state(pgdat, item);
> -	local_irq_restore(flags);
> -}
> -EXPORT_SYMBOL(inc_node_state);
> -
>  void mod_node_page_state(struct pglist_data *pgdat, enum node_stat_item item,
>  					long delta)
>  {
> -- 
> 2.34.1


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

* Re: [PATCH] mm: remove unused function inc_node_state()
  2025-12-25  7:52 ` Joshua Hahn
@ 2025-12-25 14:24   ` Wei Yang
  0 siblings, 0 replies; 4+ messages in thread
From: Wei Yang @ 2025-12-25 14:24 UTC (permalink / raw)
  To: Joshua Hahn
  Cc: Wei Yang, akpm, david, lorenzo.stoakes, Liam.Howlett, vbabka,
	rppt, surenb, mhocko, linux-mm

On Wed, Dec 24, 2025 at 11:52:17PM -0800, Joshua Hahn wrote:
>On Thu, 25 Dec 2025 01:54:45 +0000 Wei Yang <richard.weiyang@gmail.com> wrote:
>
>> The function inc_node_state() is no longer utilized by any part of the
>> kernel.
>> 
>> This commit removes the dead code.
>> 
>> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
>
>Hello Wei,
>
>Thank you for this patch! AFAICT it seems like the last users were removed
>all the way back in 2017, in 00f3ca2c2d66 ("mm: memcontrol: per-lruvec stats
>infrastructure"). 
>
>Maybe outside of the scope of this patch, but I think it might be a good
>opportunity to also remove dec_zone_state and inc_zone_state as well since
>they are right next to the functions you just remoted : -)
>

Thanks for pointing out. I will take a look into it.

>(Interestingly, dec_node_state does not exist already).

If I am correct, we don't create it at the first place.

>
>Thanks again! This patch looks good to me as-is, but please feel free to
>also remove the two functions above if that sounds reasonable to you.
>
>Have a great day!
>Reviewed-by: Joshua Hahn <joshua.hahnjy@gmail.com>
>
>> ---
>>  include/linux/vmstat.h |  2 --
>>  mm/vmstat.c            | 15 ---------------
>>  2 files changed, 17 deletions(-)
>> 
>> diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
>> index 3398a345bda8..864a78287371 100644
>> --- a/include/linux/vmstat.h
>> +++ b/include/linux/vmstat.h
>> @@ -286,7 +286,6 @@ void mod_node_page_state(struct pglist_data *, enum node_stat_item, long);
>>  void inc_node_page_state(struct page *, enum node_stat_item);
>>  void dec_node_page_state(struct page *, enum node_stat_item);
>>  
>> -extern void inc_node_state(struct pglist_data *, enum node_stat_item);
>>  extern void __inc_zone_state(struct zone *, enum zone_stat_item);
>>  extern void __inc_node_state(struct pglist_data *, enum node_stat_item);
>>  extern void dec_zone_state(struct zone *, enum zone_stat_item);
>> @@ -395,7 +394,6 @@ static inline void __dec_node_page_state(struct page *page,
>>  #define mod_node_page_state __mod_node_page_state
>>  
>>  #define inc_zone_state __inc_zone_state
>> -#define inc_node_state __inc_node_state
>>  #define dec_zone_state __dec_zone_state
>>  
>>  #define set_pgdat_percpu_threshold(pgdat, callback) { }
>> diff --git a/mm/vmstat.c b/mm/vmstat.c
>> index 090b5c5294b9..16b7cb24d411 100644
>> --- a/mm/vmstat.c
>> +++ b/mm/vmstat.c
>> @@ -671,11 +671,6 @@ void mod_node_page_state(struct pglist_data *pgdat, enum node_stat_item item,
>>  }
>>  EXPORT_SYMBOL(mod_node_page_state);
>>  
>> -void inc_node_state(struct pglist_data *pgdat, enum node_stat_item item)
>> -{
>> -	mod_node_state(pgdat, item, 1, 1);
>> -}
>> -
>>  void inc_node_page_state(struct page *page, enum node_stat_item item)
>>  {
>>  	mod_node_state(page_pgdat(page), item, 1, 1);
>> @@ -724,16 +719,6 @@ void dec_zone_page_state(struct page *page, enum zone_stat_item item)
>>  }
>>  EXPORT_SYMBOL(dec_zone_page_state);
>>  
>> -void inc_node_state(struct pglist_data *pgdat, enum node_stat_item item)
>> -{
>> -	unsigned long flags;
>> -
>> -	local_irq_save(flags);
>> -	__inc_node_state(pgdat, item);
>> -	local_irq_restore(flags);
>> -}
>> -EXPORT_SYMBOL(inc_node_state);
>> -
>>  void mod_node_page_state(struct pglist_data *pgdat, enum node_stat_item item,
>>  					long delta)
>>  {
>> -- 
>> 2.34.1

-- 
Wei Yang
Help you, Help me


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

* Re: [PATCH] mm: remove unused function inc_node_state()
  2025-12-25  1:54 [PATCH] mm: remove unused function inc_node_state() Wei Yang
  2025-12-25  7:52 ` Joshua Hahn
@ 2025-12-30 20:48 ` David Hildenbrand (Red Hat)
  1 sibling, 0 replies; 4+ messages in thread
From: David Hildenbrand (Red Hat) @ 2025-12-30 20:48 UTC (permalink / raw)
  To: Wei Yang, akpm, lorenzo.stoakes, Liam.Howlett, vbabka, rppt,
	surenb, mhocko
  Cc: linux-mm

On 12/25/25 02:54, Wei Yang wrote:
> The function inc_node_state() is no longer utilized by any part of the
> kernel.
> 
> This commit removes the dead code.
> 
> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
> ---

Acked-by: David Hildenbrand (Red Hat) <david@kernel.org>

-- 
Cheers

David


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

end of thread, other threads:[~2025-12-30 20:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-25  1:54 [PATCH] mm: remove unused function inc_node_state() Wei Yang
2025-12-25  7:52 ` Joshua Hahn
2025-12-25 14:24   ` Wei Yang
2025-12-30 20:48 ` David Hildenbrand (Red Hat)

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