(2014/11/14 12:40), Tetsuya Mukawa wrote: > I am using 1GB hugepage size. > > $ sudo QTEST_HUGETLBFS_PATH=/mnt/huge make check > region=0, mmap=0x2aaac0000000, size=6291456000 > region=0, munmap=0x2aaac0000000, size=6291456000, ret=-1 << failed > > 6291456000 is not aligned by 1GB. > When I specify 4096MB as guest memory size, munmap() doesn't return > error like following. > > $ sudo QTEST_HUGETLBFS_PATH=/mnt/huge make check > region=0, mmap=0x2aaac0000000, size=4294967296 > region=0, munmap=0x2aaac0000000, size=4294967296, ret=0 > > Also I've checked mmap2 and munmap implementation of current linux kernel. When a file on hugetlbfs is mapped, 'size' will be aligned by hugepages size in some case. But when munmap is called, 'size' will be aligned by PAGE_SIZE. It mean we cannot use same 'size' value for mmap and munmap in some case. I guess this implementation or specification cases the munmap issue.
Thanks, Tetsuya