Skip to contentSkip to conversation

userfaultfd: non-cooperative: add madvise() event for MADV_REMOVE request

PATCH New [email protected] 1 participant 1 message Feb 24, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 11/124 userfaultfd: non-cooperative: add madvise() event for MADV_REMOVE request

From: Mike Rapoport <[email protected]>
Subject: userfaultfd: non-cooperative: add madvise() event for MADV_REMOVE request

When a page is removed from a shared mapping, the uffd reader should be notified, so that it won't attempt to handle #PF events for the removed pages.

We can reuse the UFFD_EVENT_REMOVE because from the uffd monitor point of view, the semantices of madvise(MADV_DONTNEED) and madvise(MADV_REMOVE) is exactly the same.

---

 mm/madvise.c |    1 +
 1 file changed, 1 insertion(+)
mm/madvise.c renamed from mm/madvise.c~userfaultfd-non-cooperative-add-madvise-event-for-madv_remove-request +1 -0
diff -puN mm/madvise.c~userfaultfd-non-cooperative-add-madvise-event-for-madv_remove-request mm/madvise.c
@@ -520,6 +520,7 @@ static long madvise_remove(struct vm_are
 	 * mmap_sem.
 	 */
 	get_file(f);
+	userfaultfd_remove(vma, prev, start, end);
 	up_read(&current->mm->mmap_sem);
 	error = vfs_fallocate(f,
 				FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,

_