fs: hugetlb: simplify remove_inode_hugepages() return type
Subsystems (2)
PATCH v2 1/1 fs: hugetlb: simplify remove_inode_hugepages() return type
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/[email protected]
[2] https://lore.kernel.org/linux-mm/[email protected]
--- fs/hugetlbfs/inode.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-)
fs/hugetlbfs/inode.c +6 -12
@@ -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]); }
Signature · 1 line
2.53.0.rc2.204.g2597b5adb4-goog
David Hildenbrand (arm)
reviewerQuoted 22 lines · Jiaqi Yan
When
remove_inode_hugepagesis introduced in
commitc86272287bc6("hugetlb: createremove_inode_single_folioto 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 inremove_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/[email protected]
[2] https://lore.kernel.org/linux-mm/[email protected]
Quoted 6 lines
Suggested-by Jane Chu <[email protected]>Reviewed-by Jane Chu <[email protected]>Reviewed-by Muchun Song <[email protected]>Signed-off-by Jiaqi Yan <[email protected]>---
For the future, the changelog always belongs down here, under the ---, like
---
Changelog
...
fs/hugetlbfs/inode.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-)
I think I always add another "---" above the file list, not sure if that is required.
I'm sure Andrew can fix that up when applying, thanks!
Signature · 3 lines
Cheers, David
Andrew Morton
maintainerQuoted 24 lines · On Wed, 4 Feb 2026 22:54:48 +0100 "David Hildenbrand (arm)" <[email protected]>…
Quoted 12 lines
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/[email protected]
[2] https://lore.kernel.org/linux-mm/[email protected]Quoted 6 lines
Suggested-by Jane Chu <[email protected]>Reviewed-by Jane Chu <[email protected]>Reviewed-by Muchun Song <[email protected]>Signed-off-by Jiaqi Yan <[email protected]>---
For the future, the changelog always belongs down here, under the ---, like
Signed-off-by Jiaqi Yan <[email protected]>---
Quoted 8 lines
Changelog
...fs/hugetlbfs/inode.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-)I think I always add another "---" above the file list, not sure if that is required.
Interpretations might vary but the "^---$" inventor sayeth that everything below the "^---$" is not part of the changelog and is to be removed.
Also, my preference is that the permanent upstreamable changelog not contain short-term development-time information, as that's uninteresting to someone who is looking at the commit three years from now.
Material such as "how this patch differes from the previous version" and "how I tested it" is interesting and useful, but below the "^---$", please.
Beware that git interprets the separator more loosely: "^-----------" will match. So using a row of "-" characters to underline a heading is a pitfall.
Quoted 2 lines · On Wed, 4 Feb 2026 21:47:41 +0000 Jiaqi Yan <[email protected]> wrote:
When
remove_inode_hugepagesis introduced in
commitc86272287bc6("hugetlb: createremove_inode_single_folioto remove single file folio")
Why don't you wrap the above line for the 75 columns limit [1]?
Quoted 11 lines
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 inremove_inode_hugepages(). No functional change in this commit.Changelog
=========
Quoted 8 lines
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/[email protected]
[2] https://lore.kernel.org/linux-mm/[email protected]
I found David and Andrew replied the changelog will be removed in the final one, so will not add comment.
Quoted 6 lines
Suggested-by Jane Chu <[email protected]>Reviewed-by Jane Chu <[email protected]>Reviewed-by Muchun Song <[email protected]>Signed-off-by Jiaqi Yan <[email protected]>
The above comment is only trivial, and the diff looks good to me. So,
Thanks,
SJ
[...]