All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Garg, Shivank" <shivankg@amd.com>
To: "pfalcato@suse.de" <pfalcato@suse.de>,
	"nphamcs@gmail.com" <nphamcs@gmail.com>,
	"chrisl@kernel.org" <chrisl@kernel.org>,
	"shikemeng@huaweicloud.com" <shikemeng@huaweicloud.com>,
	"vbabka@kernel.org" <vbabka@kernel.org>,
	"willy@infradead.org" <willy@infradead.org>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"dev.jain@arm.com" <dev.jain@arm.com>,
	"youngjun.park@lge.com" <youngjun.park@lge.com>,
	"jack@suse.cz" <jack@suse.cz>,
	"minchan@kernel.org" <minchan@kernel.org>,
	"liam@infradead.org" <liam@infradead.org>,
	"baohua@kernel.org" <baohua@kernel.org>,
	"kasong@tencent.com" <kasong@tencent.com>,
	"jannh@google.com" <jannh@google.com>,
	"ljs@kernel.org" <ljs@kernel.org>,
	"baoquan.he@linux.dev" <baoquan.he@linux.dev>,
	"senozhatsky@chromium.org" <senozhatsky@chromium.org>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH mm-new v2 0/5] mm: remove unused functions
Date: Wed, 18 Nov 2026 18:55:02 +0000	[thread overview]
Message-ID: <c28c2ab82afa2cb3f331f1f3b3b20159bc7767b1.camel@amd.com> (raw)
In-Reply-To: <27ef4d8f-f4fa-49aa-b166-8335ca6f5898@arm.com>

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



  reply	other threads:[~2026-11-18 18:55 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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-19  4:31     ` Dev Jain
2026-11-19  5:21   ` Garg, Shivank
2026-11-19  5:35   ` + mm-remove-unused-helpers-from-pagemaph.patch added to mm-nonmm-unstable branch Andrew Morton
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-19  4:32   ` Dev Jain
2026-11-19  5:23   ` Garg, Shivank
2026-11-19  5:35   ` + mm-swapops-remove-unused-make_guard_swp_entry.patch added to mm-nonmm-unstable branch Andrew Morton
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-19  5:35   ` + mm-swap-remove-unused-folio_to_swp_tb.patch added to mm-nonmm-unstable branch Andrew Morton
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-19  4:36   ` Dev Jain
2026-11-19  5:35   ` + mm-zsmalloc-remove-unused-zpdesc_lock.patch added to mm-nonmm-unstable branch Andrew Morton
2026-11-19 19:14   ` [PATCH mm-new v2 4/5] mm/zsmalloc: remove unused zpdesc_lock() Nhat Pham
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-19  4:38   ` Dev Jain
2026-11-19  5:35   ` + mm-nommu-remove-unused-heap_stack_gap.patch added to mm-nonmm-unstable branch Andrew Morton
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 message]
2026-11-19  3:55       ` Dev Jain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c28c2ab82afa2cb3f331f1f3b3b20159bc7767b1.camel@amd.com \
    --to=shivankg@amd.com \
    --cc=akpm@linux-foundation.org \
    --cc=baohua@kernel.org \
    --cc=baoquan.he@linux.dev \
    --cc=chrisl@kernel.org \
    --cc=dev.jain@arm.com \
    --cc=jack@suse.cz \
    --cc=jannh@google.com \
    --cc=kasong@tencent.com \
    --cc=liam@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=minchan@kernel.org \
    --cc=nphamcs@gmail.com \
    --cc=pfalcato@suse.de \
    --cc=senozhatsky@chromium.org \
    --cc=shikemeng@huaweicloud.com \
    --cc=vbabka@kernel.org \
    --cc=willy@infradead.org \
    --cc=youngjun.park@lge.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.