* [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
` (2 more replies)
0 siblings, 3 replies; 6+ 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] 6+ 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 8:01 ` David Hildenbrand (Arm)
2026-11-11 3:34 ` [PATCH v2 2/2] mm: remove unused folio refcount helpers Shivank Garg
2026-11-13 9:54 ` [PATCH v2 0/2] mm: remove unused vmstat and " David Hildenbrand
2 siblings, 1 reply; 6+ 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 related [flat|nested] 6+ 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
2026-11-11 8:01 ` David Hildenbrand (Arm)
2026-11-13 9:54 ` [PATCH v2 0/2] mm: remove unused vmstat and " David Hildenbrand
2 siblings, 1 reply; 6+ 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 related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] mm/vmstat: remove unused folio stat helpers
2026-11-11 3:34 ` [PATCH v2 1/2] mm/vmstat: remove unused folio stat helpers Shivank Garg
@ 2026-11-11 8:01 ` David Hildenbrand (Arm)
0 siblings, 0 replies; 6+ messages in thread
From: David Hildenbrand (Arm) @ 2026-11-11 8:01 UTC (permalink / raw)
To: Shivank Garg, Lorenzo Stoakes, Liam R. Howlett, Vlastimil Babka,
Mike Rapoport, Suren Baghdasaryan, Michal Hocko, Matthew Wilcox
Cc: linux-mm, linux-kernel
On 11/11/26 04:34, Shivank Garg wrote:
> __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>
Reviewed-by: David Hildenbrand (Arm) <david@kernel.org>
--
Cheers,
David
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/2] mm: remove unused folio refcount helpers
2026-11-11 3:34 ` [PATCH v2 2/2] mm: remove unused folio refcount helpers Shivank Garg
@ 2026-11-11 8:01 ` David Hildenbrand (Arm)
0 siblings, 0 replies; 6+ messages in thread
From: David Hildenbrand (Arm) @ 2026-11-11 8:01 UTC (permalink / raw)
To: Shivank Garg, Lorenzo Stoakes, Liam R. Howlett, Vlastimil Babka,
Mike Rapoport, Suren Baghdasaryan, Michal Hocko, Matthew Wilcox
Cc: linux-mm, linux-kernel
On 11/11/26 04:34, Shivank Garg wrote:
> 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>
Reviewed-by: David Hildenbrand (Arm) <david@kernel.org>
--
Cheers,
David
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/2] mm: remove unused vmstat and 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 ` [PATCH v2 2/2] mm: remove unused folio refcount helpers Shivank Garg
@ 2026-11-13 9:54 ` David Hildenbrand
2 siblings, 0 replies; 6+ messages in thread
From: David Hildenbrand @ 2026-11-13 9:54 UTC (permalink / raw)
To: David Hildenbrand, Lorenzo Stoakes, Liam R. Howlett,
Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
Matthew Wilcox, Shivank Garg
Cc: linux-mm, linux-kernel
On Wed, 11 Nov 2026 03:34:32 +0000, Shivank Garg wrote:
> 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.
>
> [...]
Applied, thanks!
tree: mm/core.git
branch: core-7.5.misc
Applied patches will appear soon in mm-next, followed by linux-next.
Please report any outstanding bugs that were missed during review, so we
can either drop the patch series or decide how to fix it up.
It is encouraged to provide Acked-bys, Reviewed-bys, and Tested-bys even
though the patches have already been applied. If possible, patch trailers
will be updated.
Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. Further, this is not a guarantee that the
patches will go upstream. If in doubt, please check the listed branch.
[1/2] mm/vmstat: remove unused folio stat helpers
https://git.kernel.org/mm/core/c/b5466234
[2/2] mm: remove unused folio refcount helpers
https://git.kernel.org/mm/core/c/7b474ef2
--
Cheers,
David
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-11-13 9:55 UTC | newest]
Thread overview: 6+ 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 8:01 ` David Hildenbrand (Arm)
2026-11-11 3:34 ` [PATCH v2 2/2] mm: remove unused folio refcount helpers Shivank Garg
2026-11-11 8:01 ` David Hildenbrand (Arm)
2026-11-13 9:54 ` [PATCH v2 0/2] mm: remove unused vmstat and " David Hildenbrand
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.