mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/2] mm: remove unused vmstat and folio refcount helpers
@ 2026-11-11  3:34 Shivank Garg
  2026-11-11  3:34 ` [PATCH v2 1/2] mm/vmstat: remove unused folio stat helpers Shivank Garg
  2026-11-11  3:34 ` [PATCH v2 2/2] mm: remove unused folio refcount helpers Shivank Garg
  0 siblings, 2 replies; 3+ messages in thread
From: Shivank Garg @ 2026-11-11  3:34 UTC (permalink / raw)
  To: David Hildenbrand, Lorenzo Stoakes, Liam R. Howlett,
	Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
	Matthew Wilcox
  Cc: linux-mm, linux-kernel, Shivank Garg

This series removes ten static inline helpers from
include/linux/vmstat.h and include/linux/page_ref.h that have no users
left anywhere in the tree.

I found them with the kunused scripts [1], which I wrote with LLM's help.
The v1 cover letter [2] has more details on the scripts and how LLM was
used.

Changes in v2:
- Split v1 [2] up by MM tree, as David suggested. These two patches are
  rebased on mm/core.git/for-next. Remaining patches will be sent
  separately.
- No changes to the patches themselves.

[1] https://github.com/AMDESE/linux-mm/tree/shivank/kunused
[2] https://lore.kernel.org/r/20261026-unused-sym-v1-0-82ca2dceabe1@amd.com

Signed-off-by: Shivank Garg <shivankg@amd.com>
---
Shivank Garg (2):
      mm/vmstat: remove unused folio stat helpers
      mm: remove unused folio refcount helpers

 include/linux/page_ref.h | 24 ------------------------
 include/linux/vmstat.h   | 36 ------------------------------------
 2 files changed, 60 deletions(-)
---
base-commit: 94c0b03721e5a7187b7a017a18f58a50cee4f29e
change-id: 20261109-unused-sym-core-08c79d42936b

Best regards,
-- 
Shivank Garg <shivankg@amd.com>


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

* [PATCH v2 1/2] mm/vmstat: remove unused folio stat helpers
  2026-11-11  3:34 [PATCH v2 0/2] mm: remove unused vmstat and folio refcount helpers Shivank Garg
@ 2026-11-11  3:34 ` Shivank Garg
  2026-11-11  3:34 ` [PATCH v2 2/2] mm: remove unused folio refcount helpers Shivank Garg
  1 sibling, 0 replies; 3+ messages in thread
From: Shivank Garg @ 2026-11-11  3:34 UTC (permalink / raw)
  To: David Hildenbrand, Lorenzo Stoakes, Liam R. Howlett,
	Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
	Matthew Wilcox
  Cc: linux-mm, linux-kernel, Shivank Garg

__zone_stat_add_folio(), __zone_stat_sub_folio(), zone_stat_add_folio(),
__node_stat_add_folio() and __node_stat_sub_folio() have had no callers
since they were added in commit a53e17e4e97b ("mm/vmstat: Add functions
to account folio statistics"). The last zone_stat_sub_folio() user was
removed in commit f1ee018baee9 ("mm: use __page_cache_release() in
folios_put()").

Signed-off-by: Shivank Garg <shivankg@amd.com>
---
 include/linux/vmstat.h | 36 ------------------------------------
 1 file changed, 36 deletions(-)

diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index 5b31d8e7ae40..953d8ef65400 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -425,54 +425,18 @@ static inline void __zone_stat_mod_folio(struct folio *folio,
 	__mod_zone_page_state(folio_zone(folio), item, nr);
 }
 
-static inline void __zone_stat_add_folio(struct folio *folio,
-		enum zone_stat_item item)
-{
-	__mod_zone_page_state(folio_zone(folio), item, folio_nr_pages(folio));
-}
-
-static inline void __zone_stat_sub_folio(struct folio *folio,
-		enum zone_stat_item item)
-{
-	__mod_zone_page_state(folio_zone(folio), item, -folio_nr_pages(folio));
-}
-
 static inline void zone_stat_mod_folio(struct folio *folio,
 		enum zone_stat_item item, long nr)
 {
 	mod_zone_page_state(folio_zone(folio), item, nr);
 }
 
-static inline void zone_stat_add_folio(struct folio *folio,
-		enum zone_stat_item item)
-{
-	mod_zone_page_state(folio_zone(folio), item, folio_nr_pages(folio));
-}
-
-static inline void zone_stat_sub_folio(struct folio *folio,
-		enum zone_stat_item item)
-{
-	mod_zone_page_state(folio_zone(folio), item, -folio_nr_pages(folio));
-}
-
 static inline void __node_stat_mod_folio(struct folio *folio,
 		enum node_stat_item item, long nr)
 {
 	__mod_node_page_state(folio_pgdat(folio), item, nr);
 }
 
-static inline void __node_stat_add_folio(struct folio *folio,
-		enum node_stat_item item)
-{
-	__mod_node_page_state(folio_pgdat(folio), item, folio_nr_pages(folio));
-}
-
-static inline void __node_stat_sub_folio(struct folio *folio,
-		enum node_stat_item item)
-{
-	__mod_node_page_state(folio_pgdat(folio), item, -folio_nr_pages(folio));
-}
-
 static inline void node_stat_mod_folio(struct folio *folio,
 		enum node_stat_item item, long nr)
 {

-- 
2.53.0


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

* [PATCH v2 2/2] mm: remove unused folio refcount helpers
  2026-11-11  3:34 [PATCH v2 0/2] mm: remove unused vmstat and folio refcount helpers Shivank Garg
  2026-11-11  3:34 ` [PATCH v2 1/2] mm/vmstat: remove unused folio stat helpers Shivank Garg
@ 2026-11-11  3:34 ` Shivank Garg
  1 sibling, 0 replies; 3+ messages in thread
From: Shivank Garg @ 2026-11-11  3:34 UTC (permalink / raw)
  To: David Hildenbrand, Lorenzo Stoakes, Liam R. Howlett,
	Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
	Matthew Wilcox
  Cc: linux-mm, linux-kernel, Shivank Garg

folio_ref_inc_return(), folio_ref_dec_and_test() and folio_ref_dec_return()
have had no callers since they were added in commit c24016ac3a62 ("mm: Add
folio reference count functions"). The last folio_ref_sub_return() user
was removed in commit 38607c62b34b ("fs/dax: properly refcount fs dax
pages").

Signed-off-by: Shivank Garg <shivankg@amd.com>
---
 include/linux/page_ref.h | 24 ------------------------
 1 file changed, 24 deletions(-)

diff --git a/include/linux/page_ref.h b/include/linux/page_ref.h
index 9f5c75d06f76..6fc20a49fa84 100644
--- a/include/linux/page_ref.h
+++ b/include/linux/page_ref.h
@@ -157,15 +157,6 @@ static inline void folio_ref_sub(struct folio *folio, int nr)
 	page_ref_sub(&folio->page, nr);
 }
 
-static inline int folio_ref_sub_return(struct folio *folio, int nr)
-{
-	int ret = atomic_sub_return(nr, &folio->_refcount);
-
-	if (page_ref_tracepoint_active(page_ref_mod_and_return))
-		__page_ref_mod_and_return(&folio->page, -nr, ret);
-	return ret;
-}
-
 static inline void page_ref_inc(struct page *page)
 {
 	atomic_inc(&page->_refcount);
@@ -213,11 +204,6 @@ static inline int page_ref_inc_return(struct page *page)
 	return ret;
 }
 
-static inline int folio_ref_inc_return(struct folio *folio)
-{
-	return page_ref_inc_return(&folio->page);
-}
-
 static inline int page_ref_dec_and_test(struct page *page)
 {
 	int ret = atomic_dec_and_test(&page->_refcount);
@@ -227,11 +213,6 @@ static inline int page_ref_dec_and_test(struct page *page)
 	return ret;
 }
 
-static inline int folio_ref_dec_and_test(struct folio *folio)
-{
-	return page_ref_dec_and_test(&folio->page);
-}
-
 static inline int page_ref_dec_return(struct page *page)
 {
 	int ret = atomic_dec_return(&page->_refcount);
@@ -241,11 +222,6 @@ static inline int page_ref_dec_return(struct page *page)
 	return ret;
 }
 
-static inline int folio_ref_dec_return(struct folio *folio)
-{
-	return page_ref_dec_return(&folio->page);
-}
-
 static inline bool page_ref_add_unless_zero(struct page *page, int nr)
 {
 	bool ret = atomic_add_unless(&page->_refcount, nr, 0);

-- 
2.53.0


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

end of thread, other threads:[~2026-11-11  3:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-11  3:34 [PATCH v2 0/2] mm: remove unused vmstat and folio refcount helpers Shivank Garg
2026-11-11  3:34 ` [PATCH v2 1/2] mm/vmstat: remove unused folio stat helpers Shivank Garg
2026-11-11  3:34 ` [PATCH v2 2/2] mm: remove unused folio refcount helpers Shivank Garg

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

all inboxes | Powered by JetHome®