• Mike Kravetz's avatar
    hugetlbfs: zero partial pages during fallocate hole punch · 68d32527
    Mike Kravetz authored
    hugetlbfs fallocate support was originally added with commit 70c3547e
    ("hugetlbfs: add hugetlbfs_fallocate()").  Initial support only operated
    on whole hugetlb pages.  This makes sense for populating files as other
    interfaces such as mmap and truncate require hugetlb page size alignment. 
    Only operating on whole hugetlb pages for the hole punch case was a
    simplification and there was no compelling use case to zero partial pages.
    
    In a recent discussion[1] it was assumed that hugetlbfs hole punch would
    zero partial hugetlb pages as that is in line with the man page
    description saying 'partial filesystem blocks are zeroed'.  However, the
    hugetlbfs hole punch code actually does this:
    
            hole_start = round_up(offset, hpage_size);
            hole_end = round_down(offset + len, hpage_size);
    
    Modify code to zero partial hugetlb pages in hole punch range.  It is
    possible that application code could note a change in behavior.  However,
    that would imp...
    68d32527
inode.c 42.3 KB