[lkml]   [2015]   [Apr]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subjecthugetlbfs alignment requirements conflicting with documentation
A couple of us started looking at adding fallocate() preallocation
and punch hole support to hugetlbfs. The offset and length arguments
to fallocate are in bytes, and the man page is pretty explicit about
what is expected if ranges do not start or end on page boundaries.

Looking at fallocate led me to take a closer look at ftruncate for
hugetlbfs as ideally we would reuse some of that code. I noticed that
ftruncate requires the length parameter to be huge page aligned.
I am pretty sure this was done because hugetlbfs only deals in increments
of huge pages. inode size appears to never be set to anything that
is not a multiple of huge page size. However, the ftruncate man page
does not place too many restrictions on the value of length. And AFICT,
there is no documentation about ftruncate returning EINVAL if length
is not a multiple of huge page size.

So my question is, do we try to support hugetlbfs files that are not a
multiple of huge page size in length? Or, document that hugetlbfs is
'special' when it comes to truncate?

This same question applies to fallocate as the man page also says that
it is possible to set file size to an arbitrary (non huge page size
aligned value).

cc'ing some people from the recent hugetlb munmap alignment thread as
I'm sure they will have an opinion here.
Mike Kravetz

 \ /
  Last update: 2015-04-15 23:41    [W:0.044 / U:1.332 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site