Hi Xie, (2014/11/14 19:59), Xie, Huawei wrote: > I tested with latest qemu(with offset fix) in vhost app(not with test case), > unmap succeeds only when the size is aligned to 1GB(hugepage size). I appreciate for your testing.
> Another important thing is could we do mmap(0, region[i].memory_size, > PROT_XX, mmap_offset) rather than with offset 0? With the region above 4GB, > we will waste 4GB address space. Or we at least need to round down offset to > nearest 1GB, and round up memory size to upper 1GB, to save some address > space waste. > > Anyway, this is ugly. Kernel doesn't take care of us, do those alignment for > us automatically. > It seems 'offset' also should be aligned by hugepage size also. But it might be a specification of mmap. Manpage of mmap says 'offset' should be aligned by sysconf(_SC_PAGE_SIZE). If the target file is on hugetlbfs, I guess hugepage size is used as alignment size. Thanks, Tetsuya