]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - mm/swap_state.c
UBUNTU: [Config] CONFIG_TI_ADC108S102=m
[mirror_ubuntu-artful-kernel.git] / mm / swap_state.c
index b68c93014f50c681b5bc1f3d9da2cd8db1fe025a..fe9309ba948c4e0dcdd4a3c00fbd472ab1c5f6b8 100644 (file)
@@ -219,6 +219,17 @@ int add_to_swap(struct page *page)
                 * clear SWAP_HAS_CACHE flag.
                 */
                goto fail;
+       /*
+        * Normally the page will be dirtied in unmap because its pte should be
+        * dirty. A special case is MADV_FREE page. The page'e pte could have
+        * dirty bit cleared but the page's SwapBacked bit is still set because
+        * clearing the dirty bit and SwapBacked bit has no lock protected. For
+        * such page, unmap will not set dirty bit for it, so page reclaim will
+        * not write the page out. This can cause data corruption when the page
+        * is swap in later. Always setting the dirty bit for the page solves
+        * the problem.
+        */
+       set_page_dirty(page);
 
        return 1;