Skip to contentSkip to conversation

userfaultfd-non-cooperative-avoid-madv_dontneed-race-condition.patch removed from -mm tree

merged [email protected] 1 participant 1 message Feb 23, 2017

lore
Share & tools
lore

[email protected]

author tree notice Applied
#0 lore raw

The patch titled
Subject: userfaultfd: non-cooperative: avoid MADV_DONTNEED race condition
has been removed from the -mm tree. Its filename was
userfaultfd-non-cooperative-avoid-madv_dontneed-race-condition.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Andrea Arcangeli <[email protected]>
Subject: userfaultfd: non-cooperative: avoid MADV_DONTNEED race condition

MADV_DONTNEED must be notified to userland before the pages are zapped. This allows userland to immediately stop adding pages to the userfaultfd ranges before the pages are actually zapped or there could be non-zeropage leftovers as result of concurrent UFFDIO_COPY run in between zap_page_range and madvise_userfault_dontneed (both MADV_DONTNEED and UFFDIO_COPY runs under the mmap_sem for reading, so they can run concurrently).

Cc "Dr. David Alan Gilbert" <[email protected]>
Cc Hillf Danton <[email protected]>
Cc Michael Rapoport <[email protected]>
Cc Mike Kravetz <[email protected]>
Cc Mike Rapoport <[email protected]>
Cc Pavel Emelyanov <[email protected]>

---

 mm/madvise.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/madvise.c renamed from mm/madvise.c~userfaultfd-non-cooperative-avoid-madv_dontneed-race-condition +1 -1
diff -puN mm/madvise.c~userfaultfd-non-cooperative-avoid-madv_dontneed-race-condition mm/madvise.c
@@ -477,8 +477,8 @@ static long madvise_dontneed(struct vm_a
 	if (vma->vm_flags & (VM_LOCKED|VM_HUGETLB|VM_PFNMAP))
 		return -EINVAL;
 
-	zap_page_range(vma, start, end - start, NULL);
 	madvise_userfault_dontneed(vma, prev, start, end);
+	zap_page_range(vma, start, end - start, NULL);
 	return 0;
 }
 

_

Patches currently in -mm which might be from [email protected] are

userfaultfd-mcopy_atomic-return-enoent-when-no-compatible-vma-found-fix-2.patch userfaultfd-mcopy_atomic-return-enoent-when-no-compatible-vma-found-fix-2-fix-fix.patch