On 24/02/2017 16:46, Dr. David Alan Gilbert wrote: > * Laurent Vivier (lviv...@redhat.com) wrote: >> On 06/02/2017 18:32, Dr. David Alan Gilbert (git) wrote: >>> From: "Dr. David Alan Gilbert" <dgilb...@redhat.com> >>> >>> The kernel can't do UFFDIO_ZEROPAGE for huge pages, so we have >>> to allocate a temporary (always zero) page and use UFFDIO_COPYPAGE >>> on it. >>> >>> Signed-off-by: Dr. David Alan Gilbert <dgilb...@redhat.com> >>> Reviewed-by: Juan Quintela <quint...@redhat.com> >>> --- ... >> Are you sure the kernel doesn't support UFFDIO_ZEROPAGE for huge page. >> It seems __mcopy_atomic() manages HUGETLB vma (it is called by >> mfill_zeropage(), called by userfaultfd_zeropage())? > > That's as I understand it from Andrea; and I think it does fail if you try it.
Found the answer in kernel log: commit 7a0c4cf85b856430af62a907dd65dfc51438d24f Author: Andrea Arcangeli <aarca...@redhat.com> Date: Wed Feb 22 15:44:10 2017 -0800 userfaultfd: selftest: test UFFDIO_ZEROPAGE on all memory types This will verify -EINVAL is returned with hugetlbfs/shmem and it'll do a functional test of UFFDIO_ZEROPAGE on anonymous memory. Thanks, Laurent