[PATCH] mm/swapfile: fix swapoff vs. software dirty bits

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fixes a regression introduced with commit 179ef71cbc085252
"mm: save soft-dirty bits on swapped pages"

The maybe_same_pte() function is used to match a swap pte independent
of the swap software dirty bit set with pte_swp_mksoft_dirty().

For CONFIG_HAVE_ARCH_SOFT_DIRTY=y but CONFIG_MEM_SOFT_DIRTY=n the
software dirty bit may be set but maybe_same_pte() will not recognize
a software dirty swap pte. Due to this a 'swapoff -a' will hang.

The straightforward solution is to replace CONFIG_MEM_SOFT_DIRTY
with HAVE_ARCH_SOFT_DIRTY in maybe_same_pte().

Cc: linux-mm@xxxxxxxxx
Cc: Cyrill Gorcunov <gorcunov@xxxxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: Michal Hocko <mhocko@xxxxxxx>
Signed-off-by: Martin Schwidefsky <schwidefsky@xxxxxxxxxx>
---
 mm/swapfile.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/swapfile.c b/mm/swapfile.c
index 5887731..bf7da58 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -1113,7 +1113,7 @@ unsigned int count_swap_pages(int type, int free)
 
 static inline int maybe_same_pte(pte_t pte, pte_t swp_pte)
 {
-#ifdef CONFIG_MEM_SOFT_DIRTY
+#ifdef CONFIG_HAVE_ARCH_SOFT_DIRTY
 	/*
 	 * When pte keeps soft dirty bit the pte generated
 	 * from swap entry does not has it, still it's same
-- 
1.9.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]