]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/blobdiff - mm/swap_state.c
IB/mlx5: Add support for RSS on the inner packet
[mirror_ubuntu-focal-kernel.git] / mm / swap_state.c
index 71ce2d1ccbf7357238306d5e900a8bee7944e1cb..ed91091d1e68801daa22bd9e2d2a7833233adcfc 100644 (file)
@@ -242,6 +242,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;