[Devel] [PATCH RHEL7 COMMIT] tswap: do not writeback pages on reclaim
Konstantin Khorenko
khorenko at virtuozzo.com
Mon Jun 22 02:38:38 PDT 2015
The commit is pushed to "branch-rh7-3.10.0-123.1.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-123.1.2.vz7.5.15
------>
commit 5a69980f4e5f511b4a8fd8a5f78affbd6e90e034
Author: Vladimir Davydov <vdavydov at parallels.com>
Date: Mon Jun 22 13:38:38 2015 +0400
tswap: do not writeback pages on reclaim
Patchset description:
Patches 1 and 2 fix memory corruption caused by tswap:
https://jira.sw.ru/browse/PSBM-34269
Patch 5 fixes pinning a page in tswap.
Patch 7 fixes indefinitely long stalls during tswap reclaim.
Patch 3, 4, and 6 do cleanup.
Vladimir Davydov (6):
tswap: enable exclusive gets
tswap: do not allocate a page on store if there is already one
tswap: introduce tswap_delete_page helper
tswap: shrink tswap page if swapcache page is uptodate
tswap: use global lock to protect lru lists
tswap: do not writeback pages on reclaim
Weijie Yang (1):
mm: frontswap: invalidate expired data on a dup-store failure
###############################################################
This patch description:
Writeback slows down tswap reclaim significantly, resulting in
unpredictable stalls. Generic reclaim path takes into account a lot of
stats in order to avoid such stalls or handle them out to kswapd. We
cannot afford it, because we are outside vmscan. Instead, let us simply
move evicted tswap pages back to swapcache, marking them dirty. To avoid
ping-ponging pages from swapcache to tswap and back again, we make tswap
store avoid using emergency reserves so that a store is very likely to
fail under hard memory pressure.
Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
---
mm/tswap.c | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)
diff --git a/mm/tswap.c b/mm/tswap.c
index 4b8cef9..cdaa98a 100644
--- a/mm/tswap.c
+++ b/mm/tswap.c
@@ -11,7 +11,6 @@
#include <linux/swap.h>
#include <linux/swapops.h>
#include <linux/pagemap.h>
-#include <linux/writeback.h>
#include <linux/shrinker.h>
#include <linux/frontswap.h>
@@ -103,15 +102,12 @@ static unsigned long tswap_shrink_count(struct shrinker *shrink,
return tswap_lru_node[sc->nid].nr_items;
}
-static int tswap_writeback_page(struct page *page)
+static int tswap_evict_page(struct page *page)
{
struct address_space *swapper_space;
struct page *found_page;
swp_entry_t entry;
int err;
- struct writeback_control wbc = {
- .sync_mode = WB_SYNC_NONE,
- };
BUG_ON(!PageLocked(page));
@@ -196,18 +192,12 @@ retry:
lru_cache_add_anon(page);
SetPageUptodate(page);
-
- /* move it to the tail of the inactive list after end_writeback */
- SetPageReclaim(page);
-
- /* start writeback; unlocks the page */
- __swap_writepage(page, &wbc, end_swap_bio_write);
+ SetPageDirty(page);
return 0;
out_free_swapcache:
swapcache_free(entry, NULL);
out:
- unlock_page(page);
return err;
}
@@ -235,9 +225,10 @@ static unsigned long tswap_shrink_scan(struct shrinker *shrink,
get_page(page);
spin_unlock(&tswap_lock);
- if (tswap_writeback_page(page) == 0)
+ if (tswap_evict_page(page) == 0)
nr_reclaimed++;
+ unlock_page(page);
put_page(page);
cond_resched();
@@ -277,7 +268,8 @@ static int tswap_frontswap_store(unsigned type, pgoff_t offset,
if (cache_page)
goto copy;
- cache_page = alloc_page(__GFP_HIGHMEM | __GFP_NORETRY | __GFP_NOWARN);
+ cache_page = alloc_page(__GFP_HIGHMEM | __GFP_NORETRY |
+ __GFP_NOMEMALLOC | __GFP_NOWARN);
if (!cache_page)
return -1;
More information about the Devel
mailing list