]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - mm/khugepaged.c
NFS: Switch readdir to using iterate_shared()
[linux.git] / mm / khugepaged.c
index a8a57bebb5fac3b72a48f187d878b6e257ddc479..b679908743cb207a8433673078a943e747ad5c65 100644 (file)
@@ -1602,6 +1602,24 @@ static void collapse_file(struct mm_struct *mm,
                                        result = SCAN_FAIL;
                                        goto xa_unlocked;
                                }
+                       } else if (PageDirty(page)) {
+                               /*
+                                * khugepaged only works on read-only fd,
+                                * so this page is dirty because it hasn't
+                                * been flushed since first write. There
+                                * won't be new dirty pages.
+                                *
+                                * Trigger async flush here and hope the
+                                * writeback is done when khugepaged
+                                * revisits this page.
+                                *
+                                * This is a one-off situation. We are not
+                                * forcing writeback in loop.
+                                */
+                               xas_unlock_irq(&xas);
+                               filemap_flush(mapping);
+                               result = SCAN_FAIL;
+                               goto xa_unlocked;
                        } else if (trylock_page(page)) {
                                get_page(page);
                                xas_unlock_irq(&xas);