[Devel] [PATCH RHEL7 COMMIT] tcache: don't invalidate pages on unsuccessful put/inability to put
Konstantin Khorenko
khorenko at virtuozzo.com
Tue Dec 13 04:48:11 PST 2016
The commit is pushed to "branch-rh7-3.10.0-327.36.1.vz7.20.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.36.1.vz7.20.14
------>
commit 38b89e32958b412728db221aee6d340e853d6830
Author: Andrey Ryabinin <aryabinin at virtuozzo.com>
Date: Tue Dec 13 16:48:11 2016 +0400
tcache: don't invalidate pages on unsuccessful put/inability to put
This reverts commit 9a72c78a0e738571451596f68ab97940c24af611
("tcache: invalidate page on unsuccessful put").
There is no need to invalidate the page on unsuccessful put,
because we always put only uptodate pages in cleancache. If page becomes
outdated clencache uses cleancache_invalidate_* to remove such pages from
its cache.
This should save us some CPU cycles during reclaim if tcache is not active
or when we perform global reclaim.
https://jira.sw.ru/browse/PSBM-56475
Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
mm/tcache.c | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/mm/tcache.c b/mm/tcache.c
index 95a8259..cec5a4e 100644
--- a/mm/tcache.c
+++ b/mm/tcache.c
@@ -1141,27 +1141,24 @@ static void tcache_cleancache_put_page(int pool_id,
{
struct tcache_node *node;
struct page *cache_page = NULL;
- bool may_put = ACCESS_ONCE(tcache_active);
/* It makes no sense to populate tcache when we are short on memory */
- if (current->flags & PF_MEMALLOC)
- may_put = false;
+ if (!READ_ONCE(tcache_active) || current->flags & PF_MEMALLOC)
+ return;
- node = tcache_get_node_and_pool(pool_id, &key, may_put);
+ node = tcache_get_node_and_pool(pool_id, &key, true);
if (node) {
- if (may_put)
- cache_page = tcache_alloc_page(node->pool);
+ cache_page = tcache_alloc_page(node->pool);
if (cache_page) {
copy_highpage(cache_page, page);
/* cleancache does not care about failures */
(void)tcache_attach_page(node, index, cache_page);
- } else
- cache_page = tcache_detach_page(node, index, false);
+ }
tcache_put_node_and_pool(node);
- }
+ if (cache_page)
+ tcache_put_page(cache_page);
- if (cache_page)
- tcache_put_page(cache_page);
+ }
}
static int tcache_cleancache_get_page(int pool_id,
More information about the Devel
mailing list