Re: [PATCH mm-new v2 0/5] mm: remove unused functions

From: Dev Jain

Date: Wed Nov 18 2026 - 12:15:10 EST




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@xxxxxxx
>>
>> Signed-off-by: Shivank Garg <shivankg@xxxxxxx>
>> ---
>
> 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@xxxxxxxxxx/
> 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,
>