[Devel] [PATCH rh7] mm/tswap: make tswap work again

Andrey Ryabinin aryabinin at virtuozzo.com
Tue Apr 18 07:30:45 PDT 2017


The same issue as with tcache in "mm/tcache: make tcache work again"

Tswap uses PF_MEMALLOC to distinguish memcg recalim from global reclaim,
but sinche upstream commit 89a2848381b5 ("mm: memcontrol: do not recurse
in direct reclaim") this is no longer works as PF_MEMALLOC also set during
memcg reclaim.

Use new PF_MEMCG_RECLAIM instead of PF_MEMALLOC to identify per-memcg
recalim to avoid populating tswap during global reclaim

Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
 mm/tswap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/tswap.c b/mm/tswap.c
index 4c6c5bc..15f5adc 100644
--- a/mm/tswap.c
+++ b/mm/tswap.c
@@ -288,7 +288,7 @@ static int tswap_frontswap_store(unsigned type, pgoff_t offset,
 	if (cache_page)
 		goto copy;
 
-	if (current->flags & PF_MEMALLOC)
+	if (!(current->flags & PF_MEMCG_RECLAIM))
 		return -1;
 
 	cache_page = alloc_page(TSWAP_GFP_MASK | __GFP_HIGHMEM);
-- 
2.10.2



More information about the Devel mailing list