On Mon, 13 Jun 2022 11:36:30 -0700 Mike kravetz <mike.kravetz@xxxxxxxxxx> wrote: > On Mon, Jun 13, 2022 at 07:30:22PM +0100”, Matthew Wilcox wrote: > > On Mon, Jun 13, 2022 at 11:08:58AM -0700, Mike Kravetz wrote: > > > diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c > > > index eca1d0fabd7e..b0d0947a7e9b 100644 > > > --- a/fs/hugetlbfs/inode.c > > > +++ b/fs/hugetlbfs/inode.c > > > @@ -584,41 +584,79 @@ static void hugetlb_vmtruncate(struct inode *inode, loff_t offset) > > > remove_inode_hugepages(inode, offset, LLONG_MAX); > > > } > > > > > > +static void hugetlbfs_zero_partial_page(struct hstate *h, > > > + struct address_space *mapping, > > > + unsigned long start, > > > > This should be loff_t. Otherwise we can truncate on 32-bit machines. > > > > Thanks! I missed that. I did this: --- a/fs/hugetlbfs/inode.c~hugetlbfs-zero-partial-pages-during-fallocate-hole-punch-fix +++ a/fs/hugetlbfs/inode.c @@ -602,8 +602,7 @@ static void hugetlb_vmtruncate(struct in static void hugetlbfs_zero_partial_page(struct hstate *h, struct address_space *mapping, - unsigned long start, - unsigned long end) + loff_t start, loff_t end) { pgoff_t idx = start >> huge_page_shift(h); struct page *page; _