Hi, Jens,
Jens Axboe <[email protected]> writes:
> For now, buffers must not be file backed. If file backed buffers are
> passed in, the registration will fail with -1/EOPNOTSUPP. This
> restriction may be relaxed in the future.
[...]
> + down_write(¤t->mm->mmap_sem);
> + pret = get_user_pages_longterm(ubuf, nr_pages, FOLL_WRITE,
> + pages, vmas);
> + if (pret == nr_pages) {
> + /* don't support file backed memory */
> + for (j = 0; j < nr_pages; j++) {
> + struct vm_area_struct *vma = vmas[j];
> +
> + if (vma->vm_file) {
> + ret = -EOPNOTSUPP;
> + break;
> + }
> + }
Unfortunately, this suffers the same problem as FOLL_ANON. Huge pages
are backed by hugetlbfs, and vma->vm_file will be filled in.
I guess you could check is_file_hugepages(vma->vm_file):
if (vma->vm_file &&
!is_file_hugepages(vma->vm_file)) {
ret = -EOPNOTSUPP;
break;
}
That works for me.
-Jeff