linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] fs: hugetlb: simplify remove_inode_hugepages() return type
@ 2026-02-04 21:47 Jiaqi Yan
  2026-02-04 21:54 ` David Hildenbrand (arm)
  2026-02-05  1:13 ` SeongJae Park
  0 siblings, 2 replies; 4+ messages in thread
From: Jiaqi Yan @ 2026-02-04 21:47 UTC (permalink / raw)
  To: jane.chu, muchun.song, david
  Cc: akpm, osalvador, william.roche, linux-mm, linux-kernel, Jiaqi Yan

When remove_inode_hugepages is introduced in
commit c86272287bc6 ("hugetlb: create remove_inode_single_folio to remove single file folio")
it used to return a boolean to indicate if it bailed out due to race with
page faults. However, since the race is already solved by [1],
remove_inode_hugepages() doesn't have any path to return false anymore.

Simplify remove_inode_hugepages() return type to void, remove the
unnecessary ret variable, and adjust the call site in
remove_inode_hugepages(). No functional change in this commit.

Changelog
=========

v2 -> v1 [2]

- Use two-tab alignment for parameters wrapped to new lines.

- Remove return type in remove_inode_hugepages()'s comment.

[1] https://lore.kernel.org/all/20220914221810.95771-10-mike.kravetz@oracle.com
[2] https://lore.kernel.org/linux-mm/20260202233617.2350734-1-jiaqiyan@google.com

Suggested-by: Jane Chu <jane.chu@oracle.com>
Reviewed-by: Jane Chu <jane.chu@oracle.com>
Reviewed-by: Muchun Song <muchun.song@linux.dev>
Acked-by: David Hildenbrand (arm) <david@kernel.org>
Signed-off-by: Jiaqi Yan <jiaqiyan@google.com>
---
 fs/hugetlbfs/inode.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 3b4c152c5c73a..09c88c09718b4 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -513,15 +513,11 @@ hugetlb_vmdelete_list(struct rb_root_cached *root, pgoff_t start, pgoff_t end,
 
 /*
  * Called with hugetlb fault mutex held.
- * Returns true if page was actually removed, false otherwise.
  */
-static bool remove_inode_single_folio(struct hstate *h, struct inode *inode,
-					struct address_space *mapping,
-					struct folio *folio, pgoff_t index,
-					bool truncate_op)
+static void remove_inode_single_folio(struct hstate *h, struct inode *inode,
+		struct address_space *mapping, struct folio *folio,
+		pgoff_t index, bool truncate_op)
 {
-	bool ret = false;
-
 	/*
 	 * If folio is mapped, it was faulted in after being
 	 * unmapped in caller or hugetlb_vmdelete_list() skips
@@ -543,7 +539,6 @@ static bool remove_inode_single_folio(struct hstate *h, struct inode *inode,
 	 */
 	VM_BUG_ON_FOLIO(folio_test_hugetlb_restore_reserve(folio), folio);
 	hugetlb_delete_from_page_cache(folio);
-	ret = true;
 	if (!truncate_op) {
 		if (unlikely(hugetlb_unreserve_pages(inode, index,
 							index + 1, 1)))
@@ -551,7 +546,6 @@ static bool remove_inode_single_folio(struct hstate *h, struct inode *inode,
 	}
 
 	folio_unlock(folio);
-	return ret;
 }
 
 /*
@@ -599,9 +593,9 @@ static void remove_inode_hugepages(struct inode *inode, loff_t lstart,
 			/*
 			 * Remove folio that was part of folio_batch.
 			 */
-			if (remove_inode_single_folio(h, inode, mapping, folio,
-							index, truncate_op))
-				freed++;
+			remove_inode_single_folio(h, inode, mapping, folio,
+						  index, truncate_op);
+			freed++;
 
 			mutex_unlock(&hugetlb_fault_mutex_table[hash]);
 		}
-- 
2.53.0.rc2.204.g2597b5adb4-goog



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

end of thread, other threads:[~2026-02-05  1:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-04 21:47 [PATCH v2] fs: hugetlb: simplify remove_inode_hugepages() return type Jiaqi Yan
2026-02-04 21:54 ` David Hildenbrand (arm)
2026-02-04 22:44   ` Andrew Morton
2026-02-05  1:13 ` SeongJae Park

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox