[Devel,RHEL7,COMMIT] mm/tswap: make tswap work again

Submitted by Konstantin Khorenko on April 18, 2017, 2:42 p.m.

Details

Message ID 201704181442.v3IEg2Ww007931@finist_cl7.x64_64.work.ct
State New
Series "mm/tswap: make tswap work again"
Headers show

Commit Message

Konstantin Khorenko April 18, 2017, 2:42 p.m.
The commit is pushed to "branch-rh7-3.10.0-514.16.1.vz7.30.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-514.16.1.vz7.30.3
------>
commit ad6fbf96fe30f323e03b0f872e4eeffacbfbb264
Author: Andrey Ryabinin <aryabinin@virtuozzo.com>
Date:   Tue Apr 18 18:42:01 2017 +0400

    mm/tswap: make tswap work again
    
    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
    
    https://jira.sw.ru/browse/PSBM-64725
    
    Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
---
 mm/tswap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

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);