* [PATCH 0/8] mm: remove unused functions
@ 2026-10-26 10:30 Shivank Garg
2026-10-26 10:30 ` [PATCH 1/8] mm/vmstat: remove unused folio stat helpers Shivank Garg
` (8 more replies)
0 siblings, 9 replies; 11+ messages in thread
From: Shivank Garg @ 2026-10-26 10:30 UTC (permalink / raw)
To: Andrew Morton, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kairui Song, Qi Zheng,
Shakeel Butt, Barry Song, Axel Rasmussen, Yuanchu Xie, Wei Xu,
Baoquan He, Baolin Wang, Matthew Wilcox (Oracle),
Jan Kara, Hugh Dickins, Rik van Riel, Harry Yoo, Jann Horn,
Lance Yang, Chris Li, Kemeng Shi, Nhat Pham, Youngjun Park,
Jonathan Corbet, Shuah Khan, Johannes Weiner, Michal Hocko,
Roman Gushchin, Muchun Song, Uladzislau Rezki, SJ Park,
Minchan Kim, Sergey Senozhatsky, Alexander Potapenko,
Marco Elver, Dmitry Vyukov, Pedro Falcato, Bharata B Rao
Cc: linux-mm, linux-kernel, linux-fsdevel, cgroups, bpf, damon,
kasan-dev, Shivank Garg
This series removes 16 functions and one variable in mm that have no
users left anywhere in the tree. The functions are all static inline
helpers in headers, which no compiler warns about: GCC never reports
unused static inline functions, and Clang only reports them in .c
files, and only with W=2. The variable is heap_stack_gap in
mm/nommu.c, unused since the start of git history. Each patch covers
one file or subsystem, so they can be picked or dropped independently.
How they were found:
I wrote some Python scripts, with the help of an LLM, that scan the
whole tree for every config and architecture at once. They look for
static inline functions without callers, and for non-static functions
named nowhere but in their own definition, declarations, stubs and
EXPORT_SYMBOL(). Where a ## macro could paste together one of the
names, they read every call of that macro to see whether one does.
The candidates were then cross-checked with a real build: a scratch
tree marks each one __deprecated, an x86_64 allmodconfig build is run,
and any candidate that triggers even one deprecation warning is
dropped. The final report labels a symbol "Sure" only when that build
confirms it unused, and "Unsure" when the build doesn't compile it or
the scripts can't rule out a use.
Before posting, I searched lore with semcode MCP for removals that
others had already posted, to avoid duplicates. Each patch was also
build-tested on its own.
The scripts and a generated HTML report are here [1], if anyone wants
to play with them:
[1] https://github.com/AMDESE/linux-mm/tree/shivank/kunused
Left out on purpose:
- mmap_action_map_kernel_pages() and mmap_action_map_kernel_pages_full()
are unused but documented in Documentation/filesystems/mmap_prepare.rst.
- zone_span_writelock() and zone_span_writeunlock() are unused, which
means span_seqlock is never written while page_alloc.c still reads
it. That deserves its own patch.
- cpupid_cpu_unset() and kmsan_poison_memory() are unused, but each is
one half of a pair whose other half has users: cpupid_pid_unset() and
kmsan_unpoison_memory(). I left them out to avoid breaking the
pairing, but I'm happy to include them if that's okay.
Already posted by others, or about to get a caller, so not in this
series:
- __mm_flags_set_mask_bits_word(), by Kevin Brodsky:
https://lore.kernel.org/r/20260714-remove_pgtable_cdtor-v1-1-44be8a7685d7@arm.com
- pfn_in_present_section(), by David Hildenbrand. His series also
reworks the code around valid_section_nr(), so that one can wait until
it has landed:
https://lore.kernel.org/r/20260921-b4-sparsemem_cleanups-v2-7-54d81d65e125@kernel.org
- page_memcg_check() and mod_memcg_page_state(), by Sang-Heon Jeon and
by Tal Zussman:
https://lore.kernel.org/r/20260918165601.1014666-2-ekffu200098@gmail.com
https://lore.kernel.org/r/20261014-memcg-unused-page-helpers-v1-0-240b37c53831@columbia.edu
- vmf_insert_mixed_mkwrite(), by Sang-Heon Jeon:
https://lore.kernel.org/r/20261002160535.661399-1-ekffu200098@gmail.com
- folio_dup_file_rmap_pmd() has no caller today, but Konstantin
Khorenko's fork rework fixes it and adds one:
https://lore.kernel.org/r/20261021-b4-prep-vstor-149847-copy_huge_pmd-recheck-special-pmd-v4-0-66f00b7a564c@virtuozzo.com
- read_cache_page_gfp(), by Qu Wenruo, as the last patch of a btrfs
series in January. It hasn't been applied yet, so I've left it to
that series:
https://lore.kernel.org/r/a5ffadf18dca846d6f8086b29366288e794a24b6.1768017091.git.wqu@suse.com
- folio_is_pfmemalloc() has no caller today, but Ameer Hamza's SUNRPC
page recycling patch adds one:
https://lore.kernel.org/r/20260817210811.3984663-3-ameer.hamza@truenas.com
I'm starting with mm. Across the whole tree the scripts currently find
about ~4000 symbols, and of which 3000 pass build checks, so there's plenty of
fun left for other subsystems :)
Signed-off-by: Shivank Garg <shivankg@amd.com>
---
Shivank Garg (8):
mm/vmstat: remove unused folio stat helpers
mm: remove unused folio refcount helpers
mm/page_ext: remove unused page_ext_iter_get()
mm: remove unused helpers from pagemap.h
mm/swapops: remove unused make_guard_swp_entry()
mm/swap: remove unused folio_to_swp_tb()
mm/zsmalloc: remove unused zpdesc_lock()
mm: nommu: remove unused heap_stack_gap
include/linux/page_ext.h | 11 -----------
include/linux/page_ref.h | 24 ------------------------
include/linux/pagemap.h | 11 -----------
include/linux/swapops.h | 5 -----
include/linux/vmstat.h | 36 ------------------------------------
mm/nommu.c | 1 -
mm/swap_table.h | 5 -----
mm/zpdesc.h | 5 -----
8 files changed, 98 deletions(-)
---
base-commit: 6b4b543fa18757297ac756a6fe6e64f506b7844a
change-id: 20261024-unused-sym-f577a5b874fc
Best regards,
--
Shivank Garg <shivankg@amd.com>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/8] mm/vmstat: remove unused folio stat helpers
2026-10-26 10:30 [PATCH 0/8] mm: remove unused functions Shivank Garg
@ 2026-10-26 10:30 ` Shivank Garg
2026-10-26 10:30 ` [PATCH 2/8] mm: remove unused folio refcount helpers Shivank Garg
` (7 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Shivank Garg @ 2026-10-26 10:30 UTC (permalink / raw)
To: Andrew Morton, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kairui Song, Qi Zheng,
Shakeel Butt, Barry Song, Axel Rasmussen, Yuanchu Xie, Wei Xu,
Baoquan He, Baolin Wang, Matthew Wilcox (Oracle),
Jan Kara, Hugh Dickins, Rik van Riel, Harry Yoo, Jann Horn,
Lance Yang, Chris Li, Kemeng Shi, Nhat Pham, Youngjun Park,
Jonathan Corbet, Shuah Khan, Johannes Weiner, Michal Hocko,
Roman Gushchin, Muchun Song, Uladzislau Rezki, SJ Park,
Minchan Kim, Sergey Senozhatsky, Alexander Potapenko,
Marco Elver, Dmitry Vyukov, Pedro Falcato, Bharata B Rao
Cc: linux-mm, linux-kernel, linux-fsdevel, cgroups, bpf, damon,
kasan-dev, Shivank Garg
__zone_stat_add_folio(), __zone_stat_sub_folio(), zone_stat_add_folio(),
zone_stat_sub_folio(), __node_stat_add_folio() and __node_stat_sub_folio()
have no callers. 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] 11+ messages in thread
* [PATCH 2/8] mm: remove unused folio refcount helpers
2026-10-26 10:30 [PATCH 0/8] mm: remove unused functions Shivank Garg
2026-10-26 10:30 ` [PATCH 1/8] mm/vmstat: remove unused folio stat helpers Shivank Garg
@ 2026-10-26 10:30 ` Shivank Garg
2026-10-26 10:30 ` [PATCH 3/8] mm/page_ext: remove unused page_ext_iter_get() Shivank Garg
` (6 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Shivank Garg @ 2026-10-26 10:30 UTC (permalink / raw)
To: Andrew Morton, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kairui Song, Qi Zheng,
Shakeel Butt, Barry Song, Axel Rasmussen, Yuanchu Xie, Wei Xu,
Baoquan He, Baolin Wang, Matthew Wilcox (Oracle),
Jan Kara, Hugh Dickins, Rik van Riel, Harry Yoo, Jann Horn,
Lance Yang, Chris Li, Kemeng Shi, Nhat Pham, Youngjun Park,
Jonathan Corbet, Shuah Khan, Johannes Weiner, Michal Hocko,
Roman Gushchin, Muchun Song, Uladzislau Rezki, SJ Park,
Minchan Kim, Sergey Senozhatsky, Alexander Potapenko,
Marco Elver, Dmitry Vyukov, Pedro Falcato, Bharata B Rao
Cc: linux-mm, linux-kernel, linux-fsdevel, cgroups, bpf, damon,
kasan-dev, Shivank Garg
folio_ref_sub_return(), folio_ref_inc_return(), folio_ref_dec_and_test()
and folio_ref_dec_return() have no callers. 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] 11+ messages in thread
* [PATCH 3/8] mm/page_ext: remove unused page_ext_iter_get()
2026-10-26 10:30 [PATCH 0/8] mm: remove unused functions Shivank Garg
2026-10-26 10:30 ` [PATCH 1/8] mm/vmstat: remove unused folio stat helpers Shivank Garg
2026-10-26 10:30 ` [PATCH 2/8] mm: remove unused folio refcount helpers Shivank Garg
@ 2026-10-26 10:30 ` Shivank Garg
2026-10-26 10:30 ` [PATCH 4/8] mm: remove unused helpers from pagemap.h Shivank Garg
` (5 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Shivank Garg @ 2026-10-26 10:30 UTC (permalink / raw)
To: Andrew Morton, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kairui Song, Qi Zheng,
Shakeel Butt, Barry Song, Axel Rasmussen, Yuanchu Xie, Wei Xu,
Baoquan He, Baolin Wang, Matthew Wilcox (Oracle),
Jan Kara, Hugh Dickins, Rik van Riel, Harry Yoo, Jann Horn,
Lance Yang, Chris Li, Kemeng Shi, Nhat Pham, Youngjun Park,
Jonathan Corbet, Shuah Khan, Johannes Weiner, Michal Hocko,
Roman Gushchin, Muchun Song, Uladzislau Rezki, SJ Park,
Minchan Kim, Sergey Senozhatsky, Alexander Potapenko,
Marco Elver, Dmitry Vyukov, Pedro Falcato, Bharata B Rao
Cc: linux-mm, linux-kernel, linux-fsdevel, cgroups, bpf, damon,
kasan-dev, Shivank Garg
It was added in commit 9039b9096ea2 ("mm: page_ext: add an iteration API
for page extensions") but has never had a caller.
Signed-off-by: Shivank Garg <shivankg@amd.com>
---
include/linux/page_ext.h | 11 -----------
1 file changed, 11 deletions(-)
diff --git a/include/linux/page_ext.h b/include/linux/page_ext.h
index 79c53ec45dfa..52a8b70c525a 100644
--- a/include/linux/page_ext.h
+++ b/include/linux/page_ext.h
@@ -167,17 +167,6 @@ static inline struct page_ext *page_ext_iter_next(struct page_ext_iter *iter,
return iter->page_ext;
}
-/**
- * page_ext_iter_get() - Get current page extension
- * @iter: page extension iterator.
- *
- * Return: NULL if no page_ext exists for this iterator.
- */
-static inline struct page_ext *page_ext_iter_get(const struct page_ext_iter *iter)
-{
- return iter->page_ext;
-}
-
/**
* for_each_page_ext(): iterate through page_ext objects.
* @__page: the page we're interested in
--
2.53.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 4/8] mm: remove unused helpers from pagemap.h
2026-10-26 10:30 [PATCH 0/8] mm: remove unused functions Shivank Garg
` (2 preceding siblings ...)
2026-10-26 10:30 ` [PATCH 3/8] mm/page_ext: remove unused page_ext_iter_get() Shivank Garg
@ 2026-10-26 10:30 ` Shivank Garg
2026-10-26 10:30 ` [PATCH 5/8] mm/swapops: remove unused make_guard_swp_entry() Shivank Garg
` (4 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Shivank Garg @ 2026-10-26 10:30 UTC (permalink / raw)
To: Andrew Morton, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kairui Song, Qi Zheng,
Shakeel Butt, Barry Song, Axel Rasmussen, Yuanchu Xie, Wei Xu,
Baoquan He, Baolin Wang, Matthew Wilcox (Oracle),
Jan Kara, Hugh Dickins, Rik van Riel, Harry Yoo, Jann Horn,
Lance Yang, Chris Li, Kemeng Shi, Nhat Pham, Youngjun Park,
Jonathan Corbet, Shuah Khan, Johannes Weiner, Michal Hocko,
Roman Gushchin, Muchun Song, Uladzislau Rezki, SJ Park,
Minchan Kim, Sergey Senozhatsky, Alexander Potapenko,
Marco Elver, Dmitry Vyukov, Pedro Falcato, Bharata B Rao
Cc: linux-mm, linux-kernel, linux-fsdevel, cgroups, bpf, damon,
kasan-dev, Shivank Garg
invalidate_remote_inode() lost its last user in commit d73065e60dcc
("afs: Use alternative invalidation to using launder_folio").
mapping_clear_release_always() has no callers.
Signed-off-by: Shivank Garg <shivankg@amd.com>
---
include/linux/pagemap.h | 11 -----------
1 file changed, 11 deletions(-)
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index bcbb0afe1a68..b6ff219a78d0 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -21,12 +21,6 @@ struct folio_batch;
unsigned long invalidate_mapping_pages(struct address_space *mapping,
pgoff_t start, pgoff_t end);
-static inline void invalidate_remote_inode(struct inode *inode)
-{
- if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
- S_ISLNK(inode->i_mode))
- invalidate_mapping_pages(inode->i_mapping, 0, -1);
-}
int invalidate_inode_pages2(struct address_space *mapping);
int invalidate_inode_pages2_range(struct address_space *mapping,
pgoff_t start, pgoff_t end);
@@ -299,11 +293,6 @@ static inline void mapping_set_release_always(struct address_space *mapping)
set_bit(AS_RELEASE_ALWAYS, &mapping->flags);
}
-static inline void mapping_clear_release_always(struct address_space *mapping)
-{
- clear_bit(AS_RELEASE_ALWAYS, &mapping->flags);
-}
-
static inline bool mapping_stable_writes(const struct address_space *mapping)
{
return test_bit(AS_STABLE_WRITES, &mapping->flags);
--
2.53.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 5/8] mm/swapops: remove unused make_guard_swp_entry()
2026-10-26 10:30 [PATCH 0/8] mm: remove unused functions Shivank Garg
` (3 preceding siblings ...)
2026-10-26 10:30 ` [PATCH 4/8] mm: remove unused helpers from pagemap.h Shivank Garg
@ 2026-10-26 10:30 ` Shivank Garg
2026-10-26 10:30 ` [PATCH 6/8] mm/swap: remove unused folio_to_swp_tb() Shivank Garg
` (3 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Shivank Garg @ 2026-10-26 10:30 UTC (permalink / raw)
To: Andrew Morton, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kairui Song, Qi Zheng,
Shakeel Butt, Barry Song, Axel Rasmussen, Yuanchu Xie, Wei Xu,
Baoquan He, Baolin Wang, Matthew Wilcox (Oracle),
Jan Kara, Hugh Dickins, Rik van Riel, Harry Yoo, Jann Horn,
Lance Yang, Chris Li, Kemeng Shi, Nhat Pham, Youngjun Park,
Jonathan Corbet, Shuah Khan, Johannes Weiner, Michal Hocko,
Roman Gushchin, Muchun Song, Uladzislau Rezki, SJ Park,
Minchan Kim, Sergey Senozhatsky, Alexander Potapenko,
Marco Elver, Dmitry Vyukov, Pedro Falcato, Bharata B Rao
Cc: linux-mm, linux-kernel, linux-fsdevel, cgroups, bpf, damon,
kasan-dev, Shivank Garg
make_guard_swp_entry() has no callers.
Signed-off-by: Shivank Garg <shivankg@amd.com>
---
include/linux/swapops.h | 5 -----
1 file changed, 5 deletions(-)
diff --git a/include/linux/swapops.h b/include/linux/swapops.h
index 603f9e3f909c..6f62fc3c8cfa 100644
--- a/include/linux/swapops.h
+++ b/include/linux/swapops.h
@@ -306,11 +306,6 @@ static inline swp_entry_t make_poisoned_swp_entry(void)
return make_pte_marker_entry(PTE_MARKER_POISONED);
}
-static inline swp_entry_t make_guard_swp_entry(void)
-{
- return make_pte_marker_entry(PTE_MARKER_GUARD);
-}
-
struct page_vma_mapped_walk;
#ifdef CONFIG_ARCH_HAS_PMD_SOFTLEAVES
--
2.53.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 6/8] mm/swap: remove unused folio_to_swp_tb()
2026-10-26 10:30 [PATCH 0/8] mm: remove unused functions Shivank Garg
` (4 preceding siblings ...)
2026-10-26 10:30 ` [PATCH 5/8] mm/swapops: remove unused make_guard_swp_entry() Shivank Garg
@ 2026-10-26 10:30 ` Shivank Garg
2026-10-26 10:30 ` [PATCH 7/8] mm/zsmalloc: remove unused zpdesc_lock() Shivank Garg
` (2 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Shivank Garg @ 2026-10-26 10:30 UTC (permalink / raw)
To: Andrew Morton, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kairui Song, Qi Zheng,
Shakeel Butt, Barry Song, Axel Rasmussen, Yuanchu Xie, Wei Xu,
Baoquan He, Baolin Wang, Matthew Wilcox (Oracle),
Jan Kara, Hugh Dickins, Rik van Riel, Harry Yoo, Jann Horn,
Lance Yang, Chris Li, Kemeng Shi, Nhat Pham, Youngjun Park,
Jonathan Corbet, Shuah Khan, Johannes Weiner, Michal Hocko,
Roman Gushchin, Muchun Song, Uladzislau Rezki, SJ Park,
Minchan Kim, Sergey Senozhatsky, Alexander Potapenko,
Marco Elver, Dmitry Vyukov, Pedro Falcato, Bharata B Rao
Cc: linux-mm, linux-kernel, linux-fsdevel, cgroups, bpf, damon,
kasan-dev, Shivank Garg
Its last users were removed in commit 0d6af9bcf383 ("mm, swap: use the
swap table to track the swap count").
Signed-off-by: Shivank Garg <shivankg@amd.com>
---
mm/swap_table.h | 5 -----
1 file changed, 5 deletions(-)
diff --git a/mm/swap_table.h b/mm/swap_table.h
index e6613e62f8d0..dae7dcca3196 100644
--- a/mm/swap_table.h
+++ b/mm/swap_table.h
@@ -126,11 +126,6 @@ static inline unsigned long pfn_to_swp_tb(unsigned long pfn, unsigned char flags
return swp_tb | __flags_to_swp_tb(flags);
}
-static inline unsigned long folio_to_swp_tb(struct folio *folio, unsigned char flags)
-{
- return pfn_to_swp_tb(folio_pfn(folio), flags);
-}
-
static inline unsigned long shadow_to_swp_tb(void *shadow, unsigned char flags)
{
BUILD_BUG_ON((BITS_PER_XA_VALUE + 1) !=
--
2.53.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 7/8] mm/zsmalloc: remove unused zpdesc_lock()
2026-10-26 10:30 [PATCH 0/8] mm: remove unused functions Shivank Garg
` (5 preceding siblings ...)
2026-10-26 10:30 ` [PATCH 6/8] mm/swap: remove unused folio_to_swp_tb() Shivank Garg
@ 2026-10-26 10:30 ` Shivank Garg
2026-10-26 10:30 ` [PATCH 8/8] mm: nommu: remove unused heap_stack_gap Shivank Garg
2026-10-26 10:32 ` [PATCH 0/8] mm: remove unused functions David Hildenbrand (Arm)
8 siblings, 0 replies; 11+ messages in thread
From: Shivank Garg @ 2026-10-26 10:30 UTC (permalink / raw)
To: Andrew Morton, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kairui Song, Qi Zheng,
Shakeel Butt, Barry Song, Axel Rasmussen, Yuanchu Xie, Wei Xu,
Baoquan He, Baolin Wang, Matthew Wilcox (Oracle),
Jan Kara, Hugh Dickins, Rik van Riel, Harry Yoo, Jann Horn,
Lance Yang, Chris Li, Kemeng Shi, Nhat Pham, Youngjun Park,
Jonathan Corbet, Shuah Khan, Johannes Weiner, Michal Hocko,
Roman Gushchin, Muchun Song, Uladzislau Rezki, SJ Park,
Minchan Kim, Sergey Senozhatsky, Alexander Potapenko,
Marco Elver, Dmitry Vyukov, Pedro Falcato, Bharata B Rao
Cc: linux-mm, linux-kernel, linux-fsdevel, cgroups, bpf, damon,
kasan-dev, Shivank Garg
It was added in commit c1b3bb73d55e ("mm/zsmalloc: use zpdesc in
trylock_zspage()/lock_zspage()") but has never had a caller.
Signed-off-by: Shivank Garg <shivankg@amd.com>
---
mm/zpdesc.h | 5 -----
1 file changed, 5 deletions(-)
diff --git a/mm/zpdesc.h b/mm/zpdesc.h
index 4fd81c2e8076..aaab5f1bfb52 100644
--- a/mm/zpdesc.h
+++ b/mm/zpdesc.h
@@ -107,11 +107,6 @@ static_assert(sizeof(struct zpdesc) <= sizeof(struct page));
const struct page *: (const struct zpdesc *)(p), \
struct page *: (struct zpdesc *)(p)))
-static inline void zpdesc_lock(struct zpdesc *zpdesc)
-{
- folio_lock(zpdesc_folio(zpdesc));
-}
-
static inline bool zpdesc_trylock(struct zpdesc *zpdesc)
{
return folio_trylock(zpdesc_folio(zpdesc));
--
2.53.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 8/8] mm: nommu: remove unused heap_stack_gap
2026-10-26 10:30 [PATCH 0/8] mm: remove unused functions Shivank Garg
` (6 preceding siblings ...)
2026-10-26 10:30 ` [PATCH 7/8] mm/zsmalloc: remove unused zpdesc_lock() Shivank Garg
@ 2026-10-26 10:30 ` Shivank Garg
2026-10-26 10:32 ` [PATCH 0/8] mm: remove unused functions David Hildenbrand (Arm)
8 siblings, 0 replies; 11+ messages in thread
From: Shivank Garg @ 2026-10-26 10:30 UTC (permalink / raw)
To: Andrew Morton, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kairui Song, Qi Zheng,
Shakeel Butt, Barry Song, Axel Rasmussen, Yuanchu Xie, Wei Xu,
Baoquan He, Baolin Wang, Matthew Wilcox (Oracle),
Jan Kara, Hugh Dickins, Rik van Riel, Harry Yoo, Jann Horn,
Lance Yang, Chris Li, Kemeng Shi, Nhat Pham, Youngjun Park,
Jonathan Corbet, Shuah Khan, Johannes Weiner, Michal Hocko,
Roman Gushchin, Muchun Song, Uladzislau Rezki, SJ Park,
Minchan Kim, Sergey Senozhatsky, Alexander Potapenko,
Marco Elver, Dmitry Vyukov, Pedro Falcato, Bharata B Rao
Cc: linux-mm, linux-kernel, linux-fsdevel, cgroups, bpf, damon,
kasan-dev, Shivank Garg
heap_stack_gap has been unused since at least the start of git history,
commit 1da177e4c3f4 ("Linux-2.6.12-rc2").
Link: https://lore.kernel.org/linux-mm/20140430083620.GA4711@dhcp22.suse.cz/
Signed-off-by: Shivank Garg <shivankg@amd.com>
---
mm/nommu.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/mm/nommu.c b/mm/nommu.c
index 91ab65afda70..df8ef1323e18 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -43,7 +43,6 @@
#include "internal.h"
unsigned long highest_memmap_pfn;
-int heap_stack_gap = 0;
atomic_long_t mmap_pages_allocated;
--
2.53.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 0/8] mm: remove unused functions
2026-10-26 10:30 [PATCH 0/8] mm: remove unused functions Shivank Garg
` (7 preceding siblings ...)
2026-10-26 10:30 ` [PATCH 8/8] mm: nommu: remove unused heap_stack_gap Shivank Garg
@ 2026-10-26 10:32 ` David Hildenbrand (Arm)
2026-10-26 11:14 ` Garg, Shivank
8 siblings, 1 reply; 11+ messages in thread
From: David Hildenbrand (Arm) @ 2026-10-26 10:32 UTC (permalink / raw)
To: Shivank Garg, Andrew Morton, Lorenzo Stoakes, Liam R. Howlett,
Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
Kairui Song, Qi Zheng, Shakeel Butt, Barry Song, Axel Rasmussen,
Yuanchu Xie, Wei Xu, Baoquan He, Baolin Wang,
Matthew Wilcox (Oracle),
Jan Kara, Hugh Dickins, Rik van Riel, Harry Yoo, Jann Horn,
Lance Yang, Chris Li, Kemeng Shi, Nhat Pham, Youngjun Park,
Jonathan Corbet, Shuah Khan, Johannes Weiner, Michal Hocko,
Roman Gushchin, Muchun Song, Uladzislau Rezki, SJ Park,
Minchan Kim, Sergey Senozhatsky, Alexander Potapenko,
Marco Elver, Dmitry Vyukov, Pedro Falcato, Bharata B Rao
Cc: linux-mm, linux-kernel, linux-fsdevel, cgroups, bpf, damon, kasan-dev
On 10/26/26 11:30, Shivank Garg wrote:
> This series removes 16 functions and one variable in mm that have no
> users left anywhere in the tree. The functions are all static inline
> helpers in headers, which no compiler warns about: GCC never reports
> unused static inline functions, and Clang only reports them in .c
> files, and only with W=2. The variable is heap_stack_gap in
> mm/nommu.c, unused since the start of git history. Each patch covers
> one file or subsystem, so they can be picked or dropped independently.
>
> How they were found:
>
> I wrote some Python scripts, with the help of an LLM, that scan the
> whole tree for every config and architecture at once. They look for
> static inline functions without callers, and for non-static functions
> named nowhere but in their own definition, declarations, stubs and
> EXPORT_SYMBOL(). Where a ## macro could paste together one of the
> names, they read every call of that macro to see whether one does.
> The candidates were then cross-checked with a real build: a scratch
> tree marks each one __deprecated, an x86_64 allmodconfig build is run,
> and any candidate that triggers even one deprecation warning is
> dropped. The final report labels a symbol "Sure" only when that build
> confirms it unused, and "Unsure" when the build doesn't compile it or
> the scripts can't rule out a use.
>
> Before posting, I searched lore with semcode MCP for removals that
> others had already posted, to avoid duplicates. Each patch was also
> build-tested on its own.
>
> The scripts and a generated HTML report are here [1], if anyone wants
> to play with them:
>
After the merge window please. Focus on reviewing fixes on the list.
--
Cheers,
David
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 0/8] mm: remove unused functions
2026-10-26 10:32 ` [PATCH 0/8] mm: remove unused functions David Hildenbrand (Arm)
@ 2026-10-26 11:14 ` Garg, Shivank
0 siblings, 0 replies; 11+ messages in thread
From: Garg, Shivank @ 2026-10-26 11:14 UTC (permalink / raw)
To: senozhatsky, sj, baoquan.he, riel, david, mhocko, roman.gushchin,
jack, hannes, kasong, lance.yang, shakeel.butt, weixugc, corbet,
liam, chrisl, jannh, Rao, Bharata Bhasker, glider, youngjun.park,
yuanchu, pfalcato, rppt, axelrasmussen, dvyukov, baolin.wang,
willy, surenb, qi.zheng, minchan, skhan, hughd, shikemeng,
baohua, muchun.song, harry, nphamcs, elver, ljs, vbabka, mhocko,
akpm, urezki
Cc: kasan-dev, linux-mm, damon, linux-fsdevel, linux-kernel, cgroups, bpf
On Mon, 2026-10-26 at 11:32 +0100, David Hildenbrand (Arm) wrote:
> On 10/26/26 11:30, Shivank Garg wrote:
> >
> > The scripts and a generated HTML report are here [1], if anyone wants
> > to play with them:
> >
>
> After the merge window please. Focus on reviewing fixes on the list.
Sure. I'll resend after rc1.
Thanks,
Shivank
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2026-10-26 11:14 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-26 10:30 [PATCH 0/8] mm: remove unused functions Shivank Garg
2026-10-26 10:30 ` [PATCH 1/8] mm/vmstat: remove unused folio stat helpers Shivank Garg
2026-10-26 10:30 ` [PATCH 2/8] mm: remove unused folio refcount helpers Shivank Garg
2026-10-26 10:30 ` [PATCH 3/8] mm/page_ext: remove unused page_ext_iter_get() Shivank Garg
2026-10-26 10:30 ` [PATCH 4/8] mm: remove unused helpers from pagemap.h Shivank Garg
2026-10-26 10:30 ` [PATCH 5/8] mm/swapops: remove unused make_guard_swp_entry() Shivank Garg
2026-10-26 10:30 ` [PATCH 6/8] mm/swap: remove unused folio_to_swp_tb() Shivank Garg
2026-10-26 10:30 ` [PATCH 7/8] mm/zsmalloc: remove unused zpdesc_lock() Shivank Garg
2026-10-26 10:30 ` [PATCH 8/8] mm: nommu: remove unused heap_stack_gap Shivank Garg
2026-10-26 10:32 ` [PATCH 0/8] mm: remove unused functions David Hildenbrand (Arm)
2026-10-26 11:14 ` Garg, Shivank
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®