Merge git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml
[sfrench/cifs-2.6.git] / mm / mprotect.c
index c1d6af7455da542b9462cfc5ef8d64fa1d386a4f..625608bc89621a4033751717ebc3e8f0b3ab1f30 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/pkeys.h>
 #include <linux/ksm.h>
 #include <linux/uaccess.h>
+#include <linux/mm_inline.h>
 #include <asm/pgtable.h>
 #include <asm/cacheflush.h>
 #include <asm/mmu_context.h>
@@ -89,6 +90,14 @@ static unsigned long change_pte_range(struct vm_area_struct *vma, pmd_t *pmd,
                                    page_mapcount(page) != 1)
                                        continue;
 
+                               /*
+                                * While migration can move some dirty pages,
+                                * it cannot move them all from MIGRATE_ASYNC
+                                * context.
+                                */
+                               if (page_is_file_cache(page) && PageDirty(page))
+                                       continue;
+
                                /* Avoid TLB flush if possible */
                                if (pte_protnone(oldpte))
                                        continue;