On Mon, Sep 26, 2022, Ricardo Koller wrote: > On Thu, Sep 22, 2022 at 07:32:42PM +0000, Sean Christopherson wrote: > > On Thu, Sep 22, 2022, Ricardo Koller wrote: > > > + void *hva = (void *)region->region.userspace_addr; > > > + uint64_t paging_size = region->region.memory_size; > > > + int ret, fd = region->fd; > > > + > > > + if (fd != -1) { > > > + ret = fallocate(fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, > > > + 0, paging_size); > > > + TEST_ASSERT(ret == 0, "fallocate failed, errno: %d\n", errno); > > > + } else { > > > + if (is_backing_src_hugetlb(region->backing_src_type)) > > > + return false; > > > > Why is hugetlb disallowed? I thought anon hugetlb supports MADV_DONTNEED? > > > > It fails with EINVAL (only tried on arm) for both the PAGE_SIZE and the huge > page size. And note that the address is aligned as well. > > madvise(0xffffb7c00000, 2097152, MADV_DONTNEED) = -1 EINVAL (Invalid argument) > ^^^^^^^^^^^^^^ ^^^^^^^ > 2M aligned 2M (hugepage size) > > madvise(0xffff9e800000, 4096, MADV_DONTNEED) = -1 EINVAL (Invalid argument) > ^^^^ > PAGE_SIZE I think this needs to be root caused before merging. Unless I'm getting turned around, MADV_DONTEED should work, i.e. there is a test bug lurking somewhere.