X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=mm%2Frmap.c;h=83f8705739a23cca9fdf7bb2d2f26d6b03d31156;hb=e04ef105aa64a1c667712d65d18ac69b5612b712;hp=47db27f8049e105b88f1ed60054b1576b8056dac;hpb=51090c5d6de08cfc86b2d861775dedddd9a2c023;p=mirror_ubuntu-bionic-kernel.git diff --git a/mm/rmap.c b/mm/rmap.c index 47db27f8049e..83f8705739a2 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -64,6 +64,7 @@ #include #include #include +#include #include @@ -1483,11 +1484,16 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma, 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)); /* We have to invalidate as we cleared the pte */