On Tue, Sep 27, 2022, Ricardo Koller wrote:
> On Tue, Sep 27, 2022 at 10:06:23PM +0000, Sean Christopherson wrote:
> > 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.
>
> Turns out that the failure is documented. Found this in the madvise manpage:
>
> MADV_DONTNEED cannot be applied to locked pages, Huge TLB pages, or
> VM_PFNMAP pages.
The manpages are stale:
c4b6cb884011 ("selftests/vm: add hugetlb madvise MADV_DONTNEED MADV_REMOVE
test")
90e7e7f5ef3f ("mm: enable MADV_DONTNEED for hugetlb mappings")
The tools/testing/selftests/vm/hugetlb-madvise.c selftest effectively tests what
is being done here, so _something_ is broken.
_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm