mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH mm-new v2 0/5] mm: remove unused functions
@ 2026-11-17  7:16 Shivank Garg
  2026-11-17  7:16 ` [PATCH mm-new v2 1/5] mm: remove unused helpers from pagemap.h Shivank Garg
                   ` (5 more replies)
  0 siblings, 6 replies; 18+ messages in thread
From: Shivank Garg @ 2026-11-17  7:16 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle),
	Jan Kara, Andrew Morton, Chris Li, Kairui Song, Kemeng Shi,
	Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Minchan Kim,
	Sergey Senozhatsky, Liam R. Howlett, Lorenzo Stoakes,
	Vlastimil Babka, Jann Horn, Pedro Falcato
  Cc: linux-fsdevel, linux-mm, linux-kernel, Shivank Garg

This series removes five functions and one variable in mm 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 five patches
  are based on mm-new. 
- 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 (5):
      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/pagemap.h | 11 -----------
 include/linux/swapops.h |  5 -----
 mm/nommu.c              |  1 -
 mm/swap_table.h         |  5 -----
 mm/zpdesc.h             |  5 -----
 5 files changed, 27 deletions(-)
---
base-commit: 67f3b04b277373438f17300e056306adbd9edf7b
change-id: 20261109-unused-sym-mm-8fa76462573e

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


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

* [PATCH mm-new v2 1/5] mm: remove unused helpers from pagemap.h
  2026-11-17  7:16 [PATCH mm-new v2 0/5] mm: remove unused functions Shivank Garg
@ 2026-11-17  7:16 ` Shivank Garg
  2026-11-17 10:01   ` Barry Song
  2026-11-18 16:11   ` Dev Jain
  2026-11-17  7:16 ` [PATCH mm-new v2 2/5] mm/swapops: remove unused make_guard_swp_entry() Shivank Garg
                   ` (4 subsequent siblings)
  5 siblings, 2 replies; 18+ messages in thread
From: Shivank Garg @ 2026-11-17  7:16 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle),
	Jan Kara, Andrew Morton, Chris Li, Kairui Song, Kemeng Shi,
	Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Minchan Kim,
	Sergey Senozhatsky, Liam R. Howlett, Lorenzo Stoakes,
	Vlastimil Babka, Jann Horn, Pedro Falcato
  Cc: linux-fsdevel, linux-mm, linux-kernel, 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 73af18a37367..e681a7ba6642 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -20,12 +20,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);
@@ -298,11 +292,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] 18+ messages in thread

* [PATCH mm-new v2 2/5] mm/swapops: remove unused make_guard_swp_entry()
  2026-11-17  7:16 [PATCH mm-new v2 0/5] mm: remove unused functions Shivank Garg
  2026-11-17  7:16 ` [PATCH mm-new v2 1/5] mm: remove unused helpers from pagemap.h Shivank Garg
@ 2026-11-17  7:16 ` Shivank Garg
  2026-11-17 10:02   ` Barry Song
  2026-11-17  7:16 ` [PATCH mm-new v2 3/5] mm/swap: remove unused folio_to_swp_tb() Shivank Garg
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 18+ messages in thread
From: Shivank Garg @ 2026-11-17  7:16 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle),
	Jan Kara, Andrew Morton, Chris Li, Kairui Song, Kemeng Shi,
	Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Minchan Kim,
	Sergey Senozhatsky, Liam R. Howlett, Lorenzo Stoakes,
	Vlastimil Babka, Jann Horn, Pedro Falcato
  Cc: linux-fsdevel, linux-mm, linux-kernel, 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] 18+ messages in thread

* [PATCH mm-new v2 3/5] mm/swap: remove unused folio_to_swp_tb()
  2026-11-17  7:16 [PATCH mm-new v2 0/5] mm: remove unused functions Shivank Garg
  2026-11-17  7:16 ` [PATCH mm-new v2 1/5] mm: remove unused helpers from pagemap.h Shivank Garg
  2026-11-17  7:16 ` [PATCH mm-new v2 2/5] mm/swapops: remove unused make_guard_swp_entry() Shivank Garg
@ 2026-11-17  7:16 ` Shivank Garg
  2026-11-17 10:03   ` Barry Song
                     ` (2 more replies)
  2026-11-17  7:16 ` [PATCH mm-new v2 4/5] mm/zsmalloc: remove unused zpdesc_lock() Shivank Garg
                   ` (2 subsequent siblings)
  5 siblings, 3 replies; 18+ messages in thread
From: Shivank Garg @ 2026-11-17  7:16 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle),
	Jan Kara, Andrew Morton, Chris Li, Kairui Song, Kemeng Shi,
	Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Minchan Kim,
	Sergey Senozhatsky, Liam R. Howlett, Lorenzo Stoakes,
	Vlastimil Babka, Jann Horn, Pedro Falcato
  Cc: linux-fsdevel, linux-mm, linux-kernel, 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 072625d60d54..022d2251884e 100644
--- a/mm/swap_table.h
+++ b/mm/swap_table.h
@@ -135,11 +135,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] 18+ messages in thread

* [PATCH mm-new v2 4/5] mm/zsmalloc: remove unused zpdesc_lock()
  2026-11-17  7:16 [PATCH mm-new v2 0/5] mm: remove unused functions Shivank Garg
                   ` (2 preceding siblings ...)
  2026-11-17  7:16 ` [PATCH mm-new v2 3/5] mm/swap: remove unused folio_to_swp_tb() Shivank Garg
@ 2026-11-17  7:16 ` Shivank Garg
  2026-11-17 10:04   ` Barry Song
  2026-11-18  2:17   ` Sergey Senozhatsky
  2026-11-17  7:16 ` [PATCH mm-new v2 5/5] mm: nommu: remove unused heap_stack_gap Shivank Garg
  2026-11-18 17:05 ` [PATCH mm-new v2 0/5] mm: remove unused functions Dev Jain
  5 siblings, 2 replies; 18+ messages in thread
From: Shivank Garg @ 2026-11-17  7:16 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle),
	Jan Kara, Andrew Morton, Chris Li, Kairui Song, Kemeng Shi,
	Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Minchan Kim,
	Sergey Senozhatsky, Liam R. Howlett, Lorenzo Stoakes,
	Vlastimil Babka, Jann Horn, Pedro Falcato
  Cc: linux-fsdevel, linux-mm, linux-kernel, 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] 18+ messages in thread

* [PATCH mm-new v2 5/5] mm: nommu: remove unused heap_stack_gap
  2026-11-17  7:16 [PATCH mm-new v2 0/5] mm: remove unused functions Shivank Garg
                   ` (3 preceding siblings ...)
  2026-11-17  7:16 ` [PATCH mm-new v2 4/5] mm/zsmalloc: remove unused zpdesc_lock() Shivank Garg
@ 2026-11-17  7:16 ` Shivank Garg
  2026-11-17 10:07   ` Barry Song
  2026-11-18 17:05 ` [PATCH mm-new v2 0/5] mm: remove unused functions Dev Jain
  5 siblings, 1 reply; 18+ messages in thread
From: Shivank Garg @ 2026-11-17  7:16 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle),
	Jan Kara, Andrew Morton, Chris Li, Kairui Song, Kemeng Shi,
	Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Minchan Kim,
	Sergey Senozhatsky, Liam R. Howlett, Lorenzo Stoakes,
	Vlastimil Babka, Jann Horn, Pedro Falcato
  Cc: linux-fsdevel, linux-mm, linux-kernel, 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 df99495c8902..a971c12f2732 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] 18+ messages in thread

* Re: [PATCH mm-new v2 1/5] mm: remove unused helpers from pagemap.h
  2026-11-17  7:16 ` [PATCH mm-new v2 1/5] mm: remove unused helpers from pagemap.h Shivank Garg
@ 2026-11-17 10:01   ` Barry Song
  2026-11-18 16:11   ` Dev Jain
  1 sibling, 0 replies; 18+ messages in thread
From: Barry Song @ 2026-11-17 10:01 UTC (permalink / raw)
  To: Shivank Garg
  Cc: Matthew Wilcox (Oracle),
	Jan Kara, Andrew Morton, Chris Li, Kairui Song, Kemeng Shi,
	Nhat Pham, Baoquan He, Youngjun Park, Minchan Kim,
	Sergey Senozhatsky, Liam R. Howlett, Lorenzo Stoakes,
	Vlastimil Babka, Jann Horn, Pedro Falcato, linux-fsdevel,
	linux-mm, linux-kernel

On Tue, Nov 17, 2026 at 3:17 PM Shivank Garg <shivankg@amd.com> wrote:
>
> 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>
> ---

Reviewed-by: Barry Song <baohua@kernel.org>

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

* Re: [PATCH mm-new v2 2/5] mm/swapops: remove unused make_guard_swp_entry()
  2026-11-17  7:16 ` [PATCH mm-new v2 2/5] mm/swapops: remove unused make_guard_swp_entry() Shivank Garg
@ 2026-11-17 10:02   ` Barry Song
  0 siblings, 0 replies; 18+ messages in thread
From: Barry Song @ 2026-11-17 10:02 UTC (permalink / raw)
  To: Shivank Garg
  Cc: Matthew Wilcox (Oracle),
	Jan Kara, Andrew Morton, Chris Li, Kairui Song, Kemeng Shi,
	Nhat Pham, Baoquan He, Youngjun Park, Minchan Kim,
	Sergey Senozhatsky, Liam R. Howlett, Lorenzo Stoakes,
	Vlastimil Babka, Jann Horn, Pedro Falcato, linux-fsdevel,
	linux-mm, linux-kernel

On Tue, Nov 17, 2026 at 3:17 PM Shivank Garg <shivankg@amd.com> wrote:
>
> 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(-)
>

Reviewed-by: Barry Song <baohua@kernel.org>

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

* Re: [PATCH mm-new v2 3/5] mm/swap: remove unused folio_to_swp_tb()
  2026-11-17  7:16 ` [PATCH mm-new v2 3/5] mm/swap: remove unused folio_to_swp_tb() Shivank Garg
@ 2026-11-17 10:03   ` Barry Song
  2026-11-18 16:13   ` Dev Jain
  2026-11-18 16:23   ` Nhat Pham
  2 siblings, 0 replies; 18+ messages in thread
From: Barry Song @ 2026-11-17 10:03 UTC (permalink / raw)
  To: Shivank Garg
  Cc: Matthew Wilcox (Oracle),
	Jan Kara, Andrew Morton, Chris Li, Kairui Song, Kemeng Shi,
	Nhat Pham, Baoquan He, Youngjun Park, Minchan Kim,
	Sergey Senozhatsky, Liam R. Howlett, Lorenzo Stoakes,
	Vlastimil Babka, Jann Horn, Pedro Falcato, linux-fsdevel,
	linux-mm, linux-kernel

On Tue, Nov 17, 2026 at 3:17 PM Shivank Garg <shivankg@amd.com> wrote:
>
> 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>
> ---

Reviewed-by: Barry Song <baohua@kernel.org>

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

* Re: [PATCH mm-new v2 4/5] mm/zsmalloc: remove unused zpdesc_lock()
  2026-11-17  7:16 ` [PATCH mm-new v2 4/5] mm/zsmalloc: remove unused zpdesc_lock() Shivank Garg
@ 2026-11-17 10:04   ` Barry Song
  2026-11-18  2:17   ` Sergey Senozhatsky
  1 sibling, 0 replies; 18+ messages in thread
From: Barry Song @ 2026-11-17 10:04 UTC (permalink / raw)
  To: Shivank Garg
  Cc: Matthew Wilcox (Oracle),
	Jan Kara, Andrew Morton, Chris Li, Kairui Song, Kemeng Shi,
	Nhat Pham, Baoquan He, Youngjun Park, Minchan Kim,
	Sergey Senozhatsky, Liam R. Howlett, Lorenzo Stoakes,
	Vlastimil Babka, Jann Horn, Pedro Falcato, linux-fsdevel,
	linux-mm, linux-kernel

On Tue, Nov 17, 2026 at 3:17 PM Shivank Garg <shivankg@amd.com> wrote:
>
> 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(-)

Reviewed-by: Barry Song <baohua@kernel.org>

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

* Re: [PATCH mm-new v2 5/5] mm: nommu: remove unused heap_stack_gap
  2026-11-17  7:16 ` [PATCH mm-new v2 5/5] mm: nommu: remove unused heap_stack_gap Shivank Garg
@ 2026-11-17 10:07   ` Barry Song
  0 siblings, 0 replies; 18+ messages in thread
From: Barry Song @ 2026-11-17 10:07 UTC (permalink / raw)
  To: Shivank Garg
  Cc: Matthew Wilcox (Oracle),
	Jan Kara, Andrew Morton, Chris Li, Kairui Song, Kemeng Shi,
	Nhat Pham, Baoquan He, Youngjun Park, Minchan Kim,
	Sergey Senozhatsky, Liam R. Howlett, Lorenzo Stoakes,
	Vlastimil Babka, Jann Horn, Pedro Falcato, linux-fsdevel,
	linux-mm, linux-kernel

On Tue, Nov 17, 2026 at 3:17 PM Shivank Garg <shivankg@amd.com> wrote:
>
> 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(-)

Reviewed-by: Barry Song <baohua@kernel.org>

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

* Re: [PATCH mm-new v2 4/5] mm/zsmalloc: remove unused zpdesc_lock()
  2026-11-17  7:16 ` [PATCH mm-new v2 4/5] mm/zsmalloc: remove unused zpdesc_lock() Shivank Garg
  2026-11-17 10:04   ` Barry Song
@ 2026-11-18  2:17   ` Sergey Senozhatsky
  1 sibling, 0 replies; 18+ messages in thread
From: Sergey Senozhatsky @ 2026-11-18  2:17 UTC (permalink / raw)
  To: Shivank Garg
  Cc: Matthew Wilcox (Oracle),
	Jan Kara, Andrew Morton, Chris Li, Kairui Song, Kemeng Shi,
	Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Minchan Kim,
	Sergey Senozhatsky, Liam R. Howlett, Lorenzo Stoakes,
	Vlastimil Babka, Jann Horn, Pedro Falcato, linux-fsdevel,
	linux-mm, linux-kernel

On (26/11/17 07:16), Shivank Garg wrote:
> 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>

Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>

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

* Re: [PATCH mm-new v2 1/5] mm: remove unused helpers from pagemap.h
  2026-11-17  7:16 ` [PATCH mm-new v2 1/5] mm: remove unused helpers from pagemap.h Shivank Garg
  2026-11-17 10:01   ` Barry Song
@ 2026-11-18 16:11   ` Dev Jain
  1 sibling, 0 replies; 18+ messages in thread
From: Dev Jain @ 2026-11-18 16:11 UTC (permalink / raw)
  To: Shivank Garg, Matthew Wilcox (Oracle),
	Jan Kara, Andrew Morton, Chris Li, Kairui Song, Kemeng Shi,
	Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Minchan Kim,
	Sergey Senozhatsky, Liam R. Howlett, Lorenzo Stoakes,
	Vlastimil Babka, Jann Horn, Pedro Falcato
  Cc: linux-fsdevel, linux-mm, linux-kernel



On 17/11/26 12:46 pm, Shivank Garg wrote:
> 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.

That was added in b4fa966f03b7401ceacd4ffd7227197afb2b8376.

> 
> Signed-off-by: Shivank Garg <shivankg@amd.com>
> ---

Reviewed-by: Dev Jain <dev.jain@arm.com>


>  include/linux/pagemap.h | 11 -----------
>  1 file changed, 11 deletions(-)
> 
> diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
> index 73af18a37367..e681a7ba6642 100644
> --- a/include/linux/pagemap.h
> +++ b/include/linux/pagemap.h
> @@ -20,12 +20,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);
> @@ -298,11 +292,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);
> 


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

* Re: [PATCH mm-new v2 3/5] mm/swap: remove unused folio_to_swp_tb()
  2026-11-17  7:16 ` [PATCH mm-new v2 3/5] mm/swap: remove unused folio_to_swp_tb() Shivank Garg
  2026-11-17 10:03   ` Barry Song
@ 2026-11-18 16:13   ` Dev Jain
  2026-11-18 16:23   ` Nhat Pham
  2 siblings, 0 replies; 18+ messages in thread
From: Dev Jain @ 2026-11-18 16:13 UTC (permalink / raw)
  To: Shivank Garg, Matthew Wilcox (Oracle),
	Jan Kara, Andrew Morton, Chris Li, Kairui Song, Kemeng Shi,
	Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Minchan Kim,
	Sergey Senozhatsky, Liam R. Howlett, Lorenzo Stoakes,
	Vlastimil Babka, Jann Horn, Pedro Falcato
  Cc: linux-fsdevel, linux-mm, linux-kernel



On 17/11/26 12:46 pm, Shivank Garg wrote:
> 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>
> ---

Reviewed-by: Dev Jain <dev.jain@arm.com>


>  mm/swap_table.h | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/mm/swap_table.h b/mm/swap_table.h
> index 072625d60d54..022d2251884e 100644
> --- a/mm/swap_table.h
> +++ b/mm/swap_table.h
> @@ -135,11 +135,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) !=
> 


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

* Re: [PATCH mm-new v2 3/5] mm/swap: remove unused folio_to_swp_tb()
  2026-11-17  7:16 ` [PATCH mm-new v2 3/5] mm/swap: remove unused folio_to_swp_tb() Shivank Garg
  2026-11-17 10:03   ` Barry Song
  2026-11-18 16:13   ` Dev Jain
@ 2026-11-18 16:23   ` Nhat Pham
  2 siblings, 0 replies; 18+ messages in thread
From: Nhat Pham @ 2026-11-18 16:23 UTC (permalink / raw)
  To: Shivank Garg
  Cc: Matthew Wilcox (Oracle),
	Jan Kara, Andrew Morton, Chris Li, Kairui Song, Kemeng Shi,
	Baoquan He, Barry Song, Youngjun Park, Minchan Kim,
	Sergey Senozhatsky, Liam R. Howlett, Lorenzo Stoakes,
	Vlastimil Babka, Jann Horn, Pedro Falcato, linux-fsdevel,
	linux-mm, linux-kernel

On Mon, Nov 16, 2026 at 11:17 PM Shivank Garg <shivankg@amd.com> wrote:
>
> 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>

Reviewed-by: Nhat Pham <nphamcs@gmail.com>

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

* Re: [PATCH mm-new v2 0/5] mm: remove unused functions
  2026-11-17  7:16 [PATCH mm-new v2 0/5] mm: remove unused functions Shivank Garg
                   ` (4 preceding siblings ...)
  2026-11-17  7:16 ` [PATCH mm-new v2 5/5] mm: nommu: remove unused heap_stack_gap Shivank Garg
@ 2026-11-18 17:05 ` Dev Jain
  2026-11-18 17:14   ` Dev Jain
  5 siblings, 1 reply; 18+ messages in thread
From: Dev Jain @ 2026-11-18 17:05 UTC (permalink / raw)
  To: Shivank Garg, Matthew Wilcox (Oracle),
	Jan Kara, Andrew Morton, Chris Li, Kairui Song, Kemeng Shi,
	Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Minchan Kim,
	Sergey Senozhatsky, Liam R. Howlett, Lorenzo Stoakes,
	Vlastimil Babka, Jann Horn, Pedro Falcato
  Cc: linux-fsdevel, linux-mm, linux-kernel



On 17/11/26 12:46 pm, Shivank Garg wrote:
> This series removes five functions and one variable in mm 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 five patches
>   are based on mm-new. 
> - 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>
> ---

Okay I just recalled that there have been numerous cases where people ran
scripts / compiler with flags etc and sent patches to remove unused functions,
but maintainers rejected them citing they are there for a future use. Here
are some of those instances:

https://lore.kernel.org/all/20240907021506.4018676-1-Liam.Howlett@oracle.com/
https://lore.kernel.org/linux-mm/20100211052247.GA15392@localhost/

So I think the commit messages need to do more, they need to prove that the
unused function was a genuine oversight.



> Shivank Garg (5):
>       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/pagemap.h | 11 -----------
>  include/linux/swapops.h |  5 -----
>  mm/nommu.c              |  1 -
>  mm/swap_table.h         |  5 -----
>  mm/zpdesc.h             |  5 -----
>  5 files changed, 27 deletions(-)
> ---
> base-commit: 67f3b04b277373438f17300e056306adbd9edf7b
> change-id: 20261109-unused-sym-mm-8fa76462573e
> 
> Best regards,


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

* Re: [PATCH mm-new v2 0/5] mm: remove unused functions
  2026-11-18 17:05 ` [PATCH mm-new v2 0/5] mm: remove unused functions Dev Jain
@ 2026-11-18 17:14   ` Dev Jain
  2026-11-18 18:55     ` Garg, Shivank
  0 siblings, 1 reply; 18+ messages in thread
From: Dev Jain @ 2026-11-18 17:14 UTC (permalink / raw)
  To: Shivank Garg, Matthew Wilcox (Oracle),
	Jan Kara, Andrew Morton, Chris Li, Kairui Song, Kemeng Shi,
	Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Minchan Kim,
	Sergey Senozhatsky, Liam R. Howlett, Lorenzo Stoakes,
	Vlastimil Babka, Jann Horn, Pedro Falcato
  Cc: linux-fsdevel, linux-mm, linux-kernel



On 18/11/26 10:35 pm, Dev Jain wrote:
> 
> 
> On 17/11/26 12:46 pm, Shivank Garg wrote:
>> This series removes five functions and one variable in mm 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 five patches
>>   are based on mm-new. 
>> - 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>
>> ---
> 
> Okay I just recalled that there have been numerous cases where people ran
> scripts / compiler with flags etc and sent patches to remove unused functions,
> but maintainers rejected them citing they are there for a future use. Here
> are some of those instances:
> 
> https://lore.kernel.org/all/20240907021506.4018676-1-Liam.Howlett@oracle.com/
> https://lore.kernel.org/linux-mm/20100211052247.GA15392@localhost/
> 
> So I think the commit messages need to do more, they need to prove that the
> unused function was a genuine oversight.
> 

One way to do that would be to mention the commit and its date, if its too old,
or, if it was part of a patch series but then the author changed their
strategy in the later patches making the function redundant, etc etc.

In patch 1, you remove mapping_clear_release_always() but d73065e60dcc 's description
implies it is going to get used, which is confusing. Maybe we are missing
a genuine bug, or the author forgot to drop the stale description across
revisions.


> 
> 
>> Shivank Garg (5):
>>       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/pagemap.h | 11 -----------
>>  include/linux/swapops.h |  5 -----
>>  mm/nommu.c              |  1 -
>>  mm/swap_table.h         |  5 -----
>>  mm/zpdesc.h             |  5 -----
>>  5 files changed, 27 deletions(-)
>> ---
>> base-commit: 67f3b04b277373438f17300e056306adbd9edf7b
>> change-id: 20261109-unused-sym-mm-8fa76462573e
>>
>> Best regards,
> 


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

* Re: [PATCH mm-new v2 0/5] mm: remove unused functions
  2026-11-18 17:14   ` Dev Jain
@ 2026-11-18 18:55     ` Garg, Shivank
  0 siblings, 0 replies; 18+ messages in thread
From: Garg, Shivank @ 2026-11-18 18:55 UTC (permalink / raw)
  To: pfalcato, nphamcs, chrisl, shikemeng, vbabka, willy, akpm,
	dev.jain, youngjun.park, jack, minchan, liam, baohua, kasong,
	jannh, ljs, baoquan.he, senozhatsky
  Cc: linux-mm, linux-fsdevel, linux-kernel

On Wed, 2026-11-18 at 22:44 +0530, Dev Jain wrote:
> 
> On 18/11/26 10:35 pm, Dev Jain wrote:
> > 
> > 
> > On 17/11/26 12:46 pm, Shivank Garg wrote:
> > > This series removes five functions and one variable in mm 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 five patches
> > >   are based on mm-new. 
> > > - 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>
> > > ---
> > 
> > Okay I just recalled that there have been numerous cases where people ran
> > scripts / compiler with flags etc and sent patches to remove unused functions,
> > but maintainers rejected them citing they are there for a future use. Here
> > are some of those instances:
> > 
> > https://lore.kernel.org/all/20240907021506.4018676-1-Liam.Howlett@oracle.com/
> > https://lore.kernel.org/linux-mm/20100211052247.GA15392@localhost/
> > 
> > So I think the commit messages need to do more, they need to prove that the
> > unused function was a genuine oversight.
> > 
> 
> One way to do that would be to mention the commit and its date, if its too old,
> or, if it was part of a patch series but then the author changed their
> strategy in the later patches making the function redundant, etc etc.
> 
> In patch 1, you remove mapping_clear_release_always() but d73065e60dcc 's description
> implies it is going to get used, which is confusing. Maybe we are missing
> a genuine bug, or the author forgot to drop the stale description across
> revisions.
> 

Hi Dev,

Thanks for the review. I agree that some unused symbols may be kept
intentionally for a planned future user, which I checked for before
sending.

For most patches I had included some history, like the commit that
removed the last caller or the commit that added them without one. I
missed that for mapping_clear_release_always() in this patch and for
make_guard_swp_entry() in patch 2, so here is the history for both:

- mapping_clear_release_always() was added in b4fa966f03b7 ("mm, netfs,
  fscache: stop read optimisation when folio removed from pagecache") and
  never had a caller. Earlier version of had called it from ->evict_inode()
  but V4 dropped those calls as unnecessary [1] leaving the helper.

- make_guard_swp_entry() was added in 7c53dfbdb024 ("mm: add PTE_MARKER_GUARD
  PTE marker"), has never had a caller, and none has been posted in 2 years.

I left some symbols out because a posted series adds callers, for
example folio_dup_file_rmap_pmd() and folio_is_pfmemalloc(), or because
they are one half of a pair whose other half is still used, like
kmsan_poison_memory().

[1] https://lore.kernel.org/all/166924370539.1772793.13730698360771821317.stgit@warthog.procyon.org.uk

Thanks,
Shivank



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

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

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-17  7:16 [PATCH mm-new v2 0/5] mm: remove unused functions Shivank Garg
2026-11-17  7:16 ` [PATCH mm-new v2 1/5] mm: remove unused helpers from pagemap.h Shivank Garg
2026-11-17 10:01   ` Barry Song
2026-11-18 16:11   ` Dev Jain
2026-11-17  7:16 ` [PATCH mm-new v2 2/5] mm/swapops: remove unused make_guard_swp_entry() Shivank Garg
2026-11-17 10:02   ` Barry Song
2026-11-17  7:16 ` [PATCH mm-new v2 3/5] mm/swap: remove unused folio_to_swp_tb() Shivank Garg
2026-11-17 10:03   ` Barry Song
2026-11-18 16:13   ` Dev Jain
2026-11-18 16:23   ` Nhat Pham
2026-11-17  7:16 ` [PATCH mm-new v2 4/5] mm/zsmalloc: remove unused zpdesc_lock() Shivank Garg
2026-11-17 10:04   ` Barry Song
2026-11-18  2:17   ` Sergey Senozhatsky
2026-11-17  7:16 ` [PATCH mm-new v2 5/5] mm: nommu: remove unused heap_stack_gap Shivank Garg
2026-11-17 10:07   ` Barry Song
2026-11-18 17:05 ` [PATCH mm-new v2 0/5] mm: remove unused functions Dev Jain
2026-11-18 17:14   ` Dev Jain
2026-11-18 18:55     ` 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®