diff options
author | Andrea Arcangeli <aarcange@redhat.com> | 2015-05-14 19:31:02 +0200 |
---|---|---|
committer | Sasha Levin <sasha.levin@oracle.com> | 2015-05-18 06:28:56 -0400 |
commit | 3c0ade495f410675258f4d641ae367cd91f51cc3 (patch) | |
tree | 1f970786e7a211bf56008b99ffb6d1ce20ad1ac4 | |
parent | d615b32241ecae9b3f5b001acb24195693b7658f (diff) | |
download | mm-next-3c0ade495f410675258f4d641ae367cd91f51cc3.tar.gz |
userfaultfd: add vm_userfaultfd_ctx to the vm_area_struct
This adds the vm_userfaultfd_ctx to the vm_area_struct.
Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
-rw-r--r-- | include/linux/mm_types.h | 11 | ||||
-rw-r--r-- | kernel/fork.c | 1 |
2 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 0038ac7466fd26..2836da7c3264cc 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -265,6 +265,16 @@ struct vm_region { * this region */ }; +#ifdef CONFIG_USERFAULTFD +#define NULL_VM_UFFD_CTX ((struct vm_userfaultfd_ctx) { NULL, }) +struct vm_userfaultfd_ctx { + struct userfaultfd_ctx *ctx; +}; +#else /* CONFIG_USERFAULTFD */ +#define NULL_VM_UFFD_CTX ((struct vm_userfaultfd_ctx) {}) +struct vm_userfaultfd_ctx {}; +#endif /* CONFIG_USERFAULTFD */ + /* * This struct defines a memory VMM memory area. There is one of these * per VM-area/task. A VM area is any part of the process virtual memory @@ -331,6 +341,7 @@ struct vm_area_struct { #ifdef CONFIG_NUMA struct mempolicy *vm_policy; /* NUMA policy for the VMA */ #endif + struct vm_userfaultfd_ctx vm_userfaultfd_ctx; }; struct core_thread { diff --git a/kernel/fork.c b/kernel/fork.c index 1481cdd9b17066..430141bb81ec1c 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -451,6 +451,7 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm) goto fail_nomem_anon_vma_fork; tmp->vm_flags &= ~VM_LOCKED; tmp->vm_next = tmp->vm_prev = NULL; + tmp->vm_userfaultfd_ctx = NULL_VM_UFFD_CTX; file = tmp->vm_file; if (file) { struct inode *inode = file_inode(file); |