mirror of https://gitee.com/openkylin/linux.git
userfaultfd: add VM_UFFD_MISSING and VM_UFFD_WP
These two flags gets set in vma->vm_flags to tell the VM common code if the userfaultfd is armed and in which mode (only tracking missing faults, only tracking wrprotect faults or both). If neither flags is set it means the userfaultfd is not armed on the vma. Signed-off-by: Andrea Arcangeli <aarcange@redhat.com> Acked-by: Pavel Emelyanov <xemul@parallels.com> Cc: Sanidhya Kashyap <sanidhya.gatech@gmail.com> Cc: zhang.zhanghailiang@huawei.com Cc: "Kirill A. Shutemov" <kirill@shutemov.name> Cc: Andres Lagar-Cavilla <andreslc@google.com> Cc: Dave Hansen <dave.hansen@intel.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Rik van Riel <riel@redhat.com> Cc: Mel Gorman <mgorman@suse.de> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Hugh Dickins <hughd@google.com> Cc: Peter Feiner <pfeiner@google.com> Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: "Huangpeng (Peter)" <peter.huangpeng@huawei.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
745f234be1
commit
16ba6f811d
|
@ -597,6 +597,8 @@ static void show_smap_vma_flags(struct seq_file *m, struct vm_area_struct *vma)
|
||||||
[ilog2(VM_HUGEPAGE)] = "hg",
|
[ilog2(VM_HUGEPAGE)] = "hg",
|
||||||
[ilog2(VM_NOHUGEPAGE)] = "nh",
|
[ilog2(VM_NOHUGEPAGE)] = "nh",
|
||||||
[ilog2(VM_MERGEABLE)] = "mg",
|
[ilog2(VM_MERGEABLE)] = "mg",
|
||||||
|
[ilog2(VM_UFFD_MISSING)]= "um",
|
||||||
|
[ilog2(VM_UFFD_WP)] = "uw",
|
||||||
};
|
};
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
|
|
|
@ -124,8 +124,10 @@ extern unsigned int kobjsize(const void *objp);
|
||||||
#define VM_MAYSHARE 0x00000080
|
#define VM_MAYSHARE 0x00000080
|
||||||
|
|
||||||
#define VM_GROWSDOWN 0x00000100 /* general info on the segment */
|
#define VM_GROWSDOWN 0x00000100 /* general info on the segment */
|
||||||
|
#define VM_UFFD_MISSING 0x00000200 /* missing pages tracking */
|
||||||
#define VM_PFNMAP 0x00000400 /* Page-ranges managed without "struct page", just pure PFN */
|
#define VM_PFNMAP 0x00000400 /* Page-ranges managed without "struct page", just pure PFN */
|
||||||
#define VM_DENYWRITE 0x00000800 /* ETXTBSY on write attempts.. */
|
#define VM_DENYWRITE 0x00000800 /* ETXTBSY on write attempts.. */
|
||||||
|
#define VM_UFFD_WP 0x00001000 /* wrprotect pages tracking */
|
||||||
|
|
||||||
#define VM_LOCKED 0x00002000
|
#define VM_LOCKED 0x00002000
|
||||||
#define VM_IO 0x00004000 /* Memory mapped I/O or similar */
|
#define VM_IO 0x00004000 /* Memory mapped I/O or similar */
|
||||||
|
|
|
@ -454,7 +454,7 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
|
||||||
tmp->vm_mm = mm;
|
tmp->vm_mm = mm;
|
||||||
if (anon_vma_fork(tmp, mpnt))
|
if (anon_vma_fork(tmp, mpnt))
|
||||||
goto fail_nomem_anon_vma_fork;
|
goto fail_nomem_anon_vma_fork;
|
||||||
tmp->vm_flags &= ~VM_LOCKED;
|
tmp->vm_flags &= ~(VM_LOCKED|VM_UFFD_MISSING|VM_UFFD_WP);
|
||||||
tmp->vm_next = tmp->vm_prev = NULL;
|
tmp->vm_next = tmp->vm_prev = NULL;
|
||||||
tmp->vm_userfaultfd_ctx = NULL_VM_UFFD_CTX;
|
tmp->vm_userfaultfd_ctx = NULL_VM_UFFD_CTX;
|
||||||
file = tmp->vm_file;
|
file = tmp->vm_file;
|
||||||
|
|
Loading…
Reference in New Issue