Home Home > GIT Browse > SLE15
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMel Gorman <mgorman@suse.de>2019-02-22 12:00:31 +0000
committerMel Gorman <mgorman@suse.de>2019-02-22 12:49:38 +0000
commitffc8e80896e8c572e453bb92ad4494abf0855158 (patch)
treea8ba4ce4a25d1eca82023bed7342147e050b8f19
parent810c337c1f703322932cd2fc883580f515567834 (diff)
mm: do not drop unused pages when userfaultd is running (git
fixes (mm/userfaultfd)). suse-commit: d1c0defbb5b3bd02ad7831c57bbb808f8baec4ca
-rw-r--r--mm/rmap.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/mm/rmap.c b/mm/rmap.c
index 604fefd499f0..91f9df2567f1 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -64,6 +64,7 @@
#include <linux/backing-dev.h>
#include <linux/page_idle.h>
#include <linux/memremap.h>
+#include <linux/userfaultfd_k.h>
#include <asm/tlbflush.h>
@@ -1492,11 +1493,16 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
pteval = swp_entry_to_pte(make_hwpoison_entry(subpage));
set_pte_at(mm, address, pvmw.pte, pteval);
- } else if (pte_unused(pteval)) {
+ } else if (pte_unused(pteval) && !userfaultfd_armed(vma)) {
/*
* The guest indicated that the page content is of no
* interest anymore. Simply discard the pte, vmscan
* will take care of the rest.
+ * A future reference will then fault in a new zero
+ * page. When userfaultfd is active, we must not drop
+ * this page though, as its main user (postcopy
+ * migration) will not expect userfaults on already
+ * copied pages.
*/
dec_mm_counter(mm, mm_counter(page));
} else if (IS_ENABLED(CONFIG_MIGRATION) &&