Skip to contentSkip to conversation

mm: remove unused function inc_node_state()

PATCH In review Wei Yang 5 participants 6 messages Dec 25, 2025 – Jan 5

Subsystems (2)
lore
Share & tools
lore

Wei Yang

author
#0 lore raw

PATCH 1/1 mm: remove unused function inc_node_state()

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

This commit removes the dead code.

---
 include/linux/vmstat.h |  2 --
 mm/vmstat.c            | 15 ---------------
 2 files changed, 17 deletions(-)
include/linux/vmstat.h +0 -2
index 3398a345bda8..864a78287371 100644
@@ -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) { }
mm/vmstat.c +0 -15
index 090b5c5294b9..16b7cb24d411 100644
@@ -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)
 {
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · On Thu, 25 Dec 2025 01:54:45 +0000 Wei Yang <[email protected]> wrote:

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

This commit removes the dead code.

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!

Quoted 60 lines
---
 include/linux/vmstat.h |  2 --
 mm/vmstat.c            | 15 ---------------
 2 files changed, 17 deletions(-)
include/linux/vmstat.h +0 -2
index 3398a345bda8..864a78287371 100644
@@ -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) { }
mm/vmstat.c +0 -15
index 090b5c5294b9..16b7cb24d411 100644
@@ -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)
 {
Signature · 1 line
2.34.1
author
#2 lore raw
Quoted 11 lines · Joshua Hahn
Quoted 6 lines · On Thu, 25 Dec 2025 01:54:45 +0000 Wei Yang <[email protected]> wrote:

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

This commit removes the dead code.

Hello Wei,

Quoted 8 lines

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.

Quoted 1 line

(Interestingly, dec_node_state does not exist already).

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

Quoted 67 lines

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!

Quoted 60 lines
---
 include/linux/vmstat.h |  2 --
 mm/vmstat.c            | 15 ---------------
 2 files changed, 17 deletions(-)
include/linux/vmstat.h +0 -2
index 3398a345bda8..864a78287371 100644
@@ -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) { }
mm/vmstat.c +0 -15
index 090b5c5294b9..16b7cb24d411 100644
@@ -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)
 {
Signature · 1 line
2.34.1
Signature · 2 lines
Wei Yang
Help you, Help me
Reviewed-by on v1 1/1
#4 lore raw
In reply to Wei Yang
Quoted 54 lines · Wei Yang

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

This commit removes the dead code.

---
 include/linux/vmstat.h |  2 --
 mm/vmstat.c            | 15 ---------------
 2 files changed, 17 deletions(-)
include/linux/vmstat.h +0 -2
index 3398a345bda8..864a78287371 100644
@@ -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) { }
mm/vmstat.c +0 -8
index 090b5c5294b9..16b7cb24d411 100644
@@ -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;

mm/vmstat.c void dec_zone_page_state(struct page *page, enum zone_stat_item item) · line 724

Quoted 10 lines
mm/vmstat.c +0 -7
-
-	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)
 {
Reviewed-by on v1 1/1
#5 lore raw
In reply to Wei Yang
Quoted 6 lines · Wei Yang

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

This commit removes the dead code.

Quoted 61 lines
---
 include/linux/vmstat.h |  2 --
 mm/vmstat.c            | 15 ---------------
 2 files changed, 17 deletions(-)
include/linux/vmstat.h +0 -2
index 3398a345bda8..864a78287371 100644
@@ -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) { }
mm/vmstat.c +0 -15
index 090b5c5294b9..16b7cb24d411 100644
@@ -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)
 {
Signature · 1 line
2.34.1