mm-commits.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [folded-merged] userfaultfd-support-minor-fault-handling-for-shmem-fix-2.patch removed from -mm tree
@ 2021-04-09  2:38 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2021-04-09  2:38 UTC (permalink / raw)
  To: axelrasmussen, mm-commits, peterx


The patch titled
     Subject: userfaultfd/shmem: fix minor fault page leak
has been removed from the -mm tree.  Its filename was
     userfaultfd-support-minor-fault-handling-for-shmem-fix-2.patch

This patch was dropped because it was folded into userfaultfd-support-minor-fault-handling-for-shmem.patch

------------------------------------------------------
From: Axel Rasmussen <axelrasmussen@google.com>
Subject: userfaultfd/shmem: fix minor fault page leak

This fix is analogous to Peter Xu's fix for hugetlb [0].  If we don't
put_page() after getting the page out of the page cache, we leak the
reference.

The fix can be verified by checking /proc/meminfo and running the
userfaultfd selftest in shmem mode.  Without the fix, we see MemFree /
MemAvailable steadily decreasing with each run of the test.  With the fix,
memory is correctly freed after the test program exits.

Link: https://lkml.kernel.org/r/20210322204836.1650221-1-axelrasmussen@google.com
Signed-off-by: Axel Rasmussen <axelrasmussen@google.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/shmem.c |    1 +
 1 file changed, 1 insertion(+)

--- a/mm/shmem.c~userfaultfd-support-minor-fault-handling-for-shmem-fix-2
+++ a/mm/shmem.c
@@ -1831,6 +1831,7 @@ repeat:
 
 	if (page && vma && userfaultfd_minor(vma)) {
 		unlock_page(page);
+		put_page(page);
 		*fault_type = handle_userfault(vmf, VM_UFFD_MINOR);
 		return 0;
 	}
_

Patches currently in -mm which might be from axelrasmussen@google.com are

userfaultfd-add-minor-fault-registration-mode.patch
userfaultfd-disable-huge-pmd-sharing-for-minor-registered-vmas.patch
userfaultfd-hugetlbfs-only-compile-uffd-helpers-if-config-enabled.patch
userfaultfd-add-uffdio_continue-ioctl.patch
userfaultfd-update-documentation-to-describe-minor-fault-handling.patch
userfaultfd-selftests-add-test-exercising-minor-fault-handling.patch
userfaultfd-support-minor-fault-handling-for-shmem.patch
userfaultfd-support-minor-fault-handling-for-shmem-fix-3.patch
userfaultfd-support-minor-fault-handling-for-shmem-fix-4.patch
userfaultfd-selftests-use-memfd_create-for-shmem-test-type.patch
userfaultfd-selftests-create-alias-mappings-in-the-shmem-test.patch
userfaultfd-selftests-reinitialize-test-context-in-each-test.patch
userfaultfd-selftests-exercise-minor-fault-handling-shmem-support.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-04-09  2:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-09  2:38 [folded-merged] userfaultfd-support-minor-fault-handling-for-shmem-fix-2.patch removed from -mm tree akpm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).