author: Peter Xu <peterx@redhat.com> 2021-05-04 18:33:13 -0700
committer: Linus Torvalds <torvalds@linux-foundation.org> 2021-05-05 11:27:20 -0700
commit: 6dfeaff93be1a4cab4fb48dad7df326d05059a99
parent: 537cf30bba241ae88d5f4b0b6a5e66271b394852
Commit Summary:
Diffstat:
1 file changed, 4 insertions, 0 deletions
diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c
index 0be8cdd4425a..e5ce3b4e6c3d 100644
--- a/fs/userfaultfd.c
+++ b/fs/userfaultfd.c
@@ -15,6 +15,7 @@
#include <linux/sched/signal.h>
#include <linux/sched/mm.h>
#include <linux/mm.h>
+#include <linux/mmu_notifier.h>
#include <linux/poll.h>
#include <linux/slab.h>
#include <linux/seq_file.h>
@@ -1449,6 +1450,9 @@ static int userfaultfd_register(struct userfaultfd_ctx *ctx,
vma->vm_flags = new_flags;
vma->vm_userfaultfd_ctx.ctx = ctx;
+ if (is_vm_hugetlb_page(vma) && uffd_disable_huge_pmd_share(vma))
+ hugetlb_unshare_all_pmds(vma);
+
skip:
prev = vma;
start = vma->vm_end;