Kel*_*Lee 2 linux memory-management shared-memory memory-mapped-files linux-kernel
我从userfaultfd的文档中看到
https://manpages.debian.org/testing/manpages-dev/userfaultfd.2.en.html http://man7.org/linux/man-pages/man2/ioctl_userfaultfd.2.html
userfaultfd 从内核 4.11 开始支持共享映射。然而,文档看起来仍然非常模糊,因为我仍然想知道这些是否包括支持文件支持的 mmap(也可以是 MAP_SHARED)?
为了明确回答,由于该信息不在手册页中,因此我们可以查看来源。
\n尝试使用地址范围注册 userfaultfd 对象必须检查该范围是否“兼容”:
\n\xe2\x80\xa6\n/* check not compatible vmas */\nret = -EINVAL;\nif (!vma_can_userfault(cur))\n goto out_unlock;\nRun Code Online (Sandbox Code Playgroud)\n兼容性的定义为:
\nif ((vm_flags & VM_UFFD_MINOR) &&\n (!is_vm_hugetlb_page(vma) && !vma_is_shmem(vma)))\n return false;\n#ifndef CONFIG_PTE_MARKER_UFFD_WP\n/*\n * If user requested uffd-wp but not enabled pte markers for\n * uffd-wp, then shmem & hugetlbfs are not supported but only\n * anonymous.\n */\nif ((vm_flags & VM_UFFD_WP) && !vma_is_anonymous(vma))\n return false;\n#endif\nreturn vma_is_anonymous(vma) || is_vm_hugetlb_page(vma) ||\n vma_is_shmem(vma);\nRun Code Online (Sandbox Code Playgroud)\n因此,匿名映射或映射在:
\nshmget)映射是兼容的generic_file_mmap)为共享的文件支持范围也兼容的含义VM_UFFD_MINOR是支持小页面错误的通知。
| 归档时间: |
|
| 查看次数: |
377 次 |
| 最近记录: |