Currently, we try to create a tcache node even if we are not going to actually store a page in tcache (tcache is disabled or we are called by global reclaimer). This is suboptimal, because we will drop the node anyway then.
Signed-off-by: Vladimir Davydov <[email protected]> --- mm/tcache.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mm/tcache.c b/mm/tcache.c index b078c84f9564..ce5b0edd8253 100644 --- a/mm/tcache.c +++ b/mm/tcache.c @@ -835,10 +835,15 @@ 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); - node = tcache_get_node_and_pool(pool_id, &key, true); + /* It makes no sense to populate tcache when we are short on memory */ + if (current->flags & PF_MEMALLOC) + may_put = false; + + node = tcache_get_node_and_pool(pool_id, &key, may_put); if (node) { - if (tcache_active && !(current->flags & PF_MEMALLOC)) + if (may_put) cache_page = tcache_alloc_page(); if (cache_page) { copy_highpage(cache_page, page); -- 2.1.4 _______________________________________________ Devel mailing list [email protected] https://lists.openvz.org/mailman/listinfo/devel
