[PATCH] hugetlbfs: fix stale comment in hugetlbfs_file_mmap()

Zhenghui Hao posted 1 patch 1 day, 11 hours ago
fs/hugetlbfs/inode.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
[PATCH] hugetlbfs: fix stale comment in hugetlbfs_file_mmap()
Posted by Zhenghui Hao 1 day, 11 hours ago
The comment above the VMA flag setup in hugetlbfs_file_mmap() says the VMA
address alignment has already been checked by prepare_hugepage_range().
That function no longer exists: it was removed by commit eff41389d824
("mm/hugetlb: remove prepare_hugepage_range()"), and the check now lives in
hugetlb_get_unmapped_area().

The comment also mentions ia64, which was removed from the tree by commit
cf8e8658100d ("arch: Remove Itanium (IA-64) architecture").

Point the comment at the current function and drop the ia64 reference.  The
rest of the comment, which tells future edits to add any error return only
after VM_HUGETLB has been set, is still accurate and is left untouched.

No functional change.

Signed-off-by: Zhenghui Hao <zhenghui.hao@qq.com>
---
 fs/hugetlbfs/inode.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 7611a8470ea2..e2aaf1b56e7f 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -106,11 +106,10 @@ static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma)
 
 	/*
 	 * vma address alignment (but not the pgoff alignment) has
-	 * already been checked by prepare_hugepage_range.  If you add
-	 * any error returns here, do so after setting VM_HUGETLB, so
-	 * is_vm_hugetlb_page tests below unmap_region go the right
-	 * way when do_mmap unwinds (may be important on powerpc
-	 * and ia64).
+	 * already been checked by hugetlb_get_unmapped_area().  If you
+	 * add any error returns here, do so after setting VM_HUGETLB,
+	 * so is_vm_hugetlb_page tests below unmap_region go the right
+	 * way when do_mmap unwinds (may be important on powerpc).
 	 */
 	vma_set_flags(vma, VMA_HUGETLB_BIT, VMA_DONTEXPAND_BIT);
 	vma->vm_ops = &hugetlb_vm_ops;

base-commit: 93f51579e7df248780214094418f205253383cc5
-- 
2.53.0
Re: [PATCH] hugetlbfs: fix stale comment in hugetlbfs_file_mmap()
Posted by Muchun Song 1 day, 10 hours ago

> On Sep 23, 2026, at 10:28, Zhenghui Hao <zhenghui.hao@qq.com> wrote:
> 
> The comment above the VMA flag setup in hugetlbfs_file_mmap() says the VMA
> address alignment has already been checked by prepare_hugepage_range().
> That function no longer exists: it was removed by commit eff41389d824
> ("mm/hugetlb: remove prepare_hugepage_range()"), and the check now lives in
> hugetlb_get_unmapped_area().
> 
> The comment also mentions ia64, which was removed from the tree by commit
> cf8e8658100d ("arch: Remove Itanium (IA-64) architecture").
> 
> Point the comment at the current function and drop the ia64 reference.  The
> rest of the comment, which tells future edits to add any error return only
> after VM_HUGETLB has been set, is still accurate and is left untouched.
> 
> No functional change.
> 
> Signed-off-by: Zhenghui Hao <zhenghui.hao@qq.com>

Acked-by: Muchun Song <muchun.song@linux.dev>

THanks.