userfaultfd: non-cooperative: add madvise() event for MADV_REMOVE request
Subsystems (2)
[email protected]
maintainerPATCH 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.
Signed-off-by Mike Rapoport <[email protected]>
Reviewed-by Andrea Arcangeli <[email protected]>
Acked-by Hillf Danton <[email protected]>
Acked-by Pavel Emelyanov <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
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
@@ -520,6 +520,7 @@ static long madvise_remove(struct vm_are* mmap_sem. */ get_file (f); +userfaultfd_remove (vma, prev, start, end);up_read (¤t->mm->mmap_sem); error = vfs_fallocate(f, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
_