[PATCH v4 14/17] mm/huge_memory: drop the unused do_lru argument of the file split helper

From: Kairui Song via B4 Relay

Date: Mon Sep 07 2026 - 14:13:37 EST


From: Kairui Song <kasong@xxxxxxxxxxx>

The only caller of __folio_freeze_split_file() always passes do_lru as
true, so the argument and the branches gated on it are dead code.
Drop it.

Reviewed-by: Zi Yan <ziy@xxxxxxxxxx>
Acked-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
Reviewed-by: Yeoreum Yun <yeoreum.yun@xxxxxxx>
Signed-off-by: Kairui Song <kasong@xxxxxxxxxxx>
---
mm/huge_memory.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index ccd48cd5f94b..6ce58a5d93d8 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -4107,8 +4107,7 @@ static int __folio_freeze_split_anon(struct folio *folio,

static int __folio_freeze_split_file(struct folio *folio,
unsigned int new_order, struct page *split_at,
- bool do_lru, struct list_head *list,
- enum split_type split_type)
+ struct list_head *list, enum split_type split_type)
{
struct address_space *mapping = folio->mapping;
XA_STATE(xas, &mapping->i_pages, folio->index);
@@ -4202,9 +4201,7 @@ static int __folio_freeze_split_file(struct folio *folio,
}

/* lock lru list/PageCompound, ref frozen by page_ref_freeze */
- if (do_lru)
- lruvec = folio_lruvec_lock(folio);
-
+ lruvec = folio_lruvec_lock(folio);
ret = __split_frozen_folio(folio, new_order, split_at, &xas,
mapping, split_type);

@@ -4226,8 +4223,7 @@ static int __folio_freeze_split_file(struct folio *folio,
folio_ref_unfreeze(new_folio,
folio_cache_ref_count(new_folio) + 1);

- if (do_lru)
- lru_add_split_folio(folio, new_folio, lruvec, list);
+ lru_add_split_folio(folio, new_folio, lruvec, list);

/* Add the new folio to the page cache. */
if (new_folio->index < end) {
@@ -4253,9 +4249,7 @@ static int __folio_freeze_split_file(struct folio *folio,
* and its caller can see stale page cache entries.
*/
folio_ref_unfreeze(folio, folio_cache_ref_count(folio) + 1);
-
- if (do_lru)
- lruvec_unlock(lruvec);
+ lruvec_unlock(lruvec);
fail:
/*
* If we want to use try_to_migrate() on file in unmap_folio,
@@ -4335,7 +4329,7 @@ static int __folio_split(struct folio *folio, unsigned int new_order,
true, list, split_type);
else
ret = __folio_freeze_split_file(folio, new_order, split_at,
- true, list, split_type);
+ list, split_type);

/*
* Unlock all after-split folios except the one containing

--
2.55.0