aboutsummaryrefslogtreecommitdiffstats
path: root/mm/swap_state.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2017-10-05 17:57:03 -0700
committerDavid S. Miller <davem@davemloft.net>2017-10-05 18:19:22 -0700
commit53954cf8c5d205624167a2bfd117cc0c1a5f3c6d (patch)
treea287f0c80eb616758bb5212523c8fb3d8fc350a4 /mm/swap_state.c
parentMerge branch 'bpftool' (diff)
parentMerge tag 'pm-4.14-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm (diff)
downloadlinux-dev-53954cf8c5d205624167a2bfd117cc0c1a5f3c6d.tar.xz
linux-dev-53954cf8c5d205624167a2bfd117cc0c1a5f3c6d.zip
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Just simple overlapping changes. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'mm/swap_state.c')
-rw-r--r--mm/swap_state.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/mm/swap_state.c b/mm/swap_state.c
index 71ce2d1ccbf7..ed91091d1e68 100644
--- a/mm/swap_state.c
+++ b/mm/swap_state.c
@@ -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;