[Devel] [PATCH rh7 v3 01/10] tcache: Decrement removed from LRU pages out of __tcache_lru_del()

Kirill Tkhai ktkhai at virtuozzo.com
Wed Aug 16 17:51:15 MSK 2017


Move the subtraction out of __tcache_lru_del, and this will be used
in next patches. Also, delete ni argument of the function.

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 mm/tcache.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/mm/tcache.c b/mm/tcache.c
index 0bfbb69aa7b..9f296dc3bde 100644
--- a/mm/tcache.c
+++ b/mm/tcache.c
@@ -274,11 +274,9 @@ static void tcache_lru_add(struct tcache_pool *pool, struct page *page)
 	spin_unlock(&ni->lock);
 }
 
-static void __tcache_lru_del(struct tcache_nodeinfo *ni,
-			     struct tcache_pool_nodeinfo *pni,
+static void __tcache_lru_del(struct tcache_pool_nodeinfo *pni,
 			     struct page *page)
 {
-	ni->nr_pages--;
 	pni->nr_pages--;
 	list_del_init(&page->lru);
 }
@@ -300,7 +298,8 @@ static void tcache_lru_del(struct tcache_pool *pool, struct page *page,
 	if (unlikely(list_empty(&page->lru)))
 		goto out;
 
-	__tcache_lru_del(ni, pni, page);
+	__tcache_lru_del(pni, page);
+	ni->nr_pages--;
 
 	if (reused)
 		pni->recent_gets++;
@@ -988,8 +987,7 @@ __tcache_insert_reclaim_node(struct tcache_nodeinfo *ni,
 }
 
 static noinline_for_stack int
-__tcache_lru_isolate(struct tcache_nodeinfo *ni,
-		     struct tcache_pool_nodeinfo *pni,
+__tcache_lru_isolate(struct tcache_pool_nodeinfo *pni,
 		     struct page **pages, int nr_to_scan)
 {
 	struct tcache_node *node;
@@ -1002,7 +1000,7 @@ __tcache_lru_isolate(struct tcache_nodeinfo *ni,
 		if (unlikely(!page_cache_get_speculative(page)))
 			continue;
 
-		__tcache_lru_del(ni, pni, page);
+		__tcache_lru_del(pni, page);
 
 		/*
 		 * A node can be destroyed only if all its pages have been
@@ -1041,7 +1039,8 @@ tcache_lru_isolate(int nid, struct page **pages, int nr_to_isolate)
 	if (!tcache_grab_pool(pni->pool))
 		goto again;
 
-	nr = __tcache_lru_isolate(ni, pni, pages, nr_to_isolate);
+	nr = __tcache_lru_isolate(pni, pages, nr_to_isolate);
+	ni->nr_pages -= nr;
 	nr_isolated += nr;
 	nr_to_isolate -= nr;
 
@@ -1093,7 +1092,8 @@ tcache_try_to_reclaim_page(struct tcache_pool *pool, int nid)
 	local_irq_save(flags);
 
 	spin_lock(&ni->lock);
-	ret = __tcache_lru_isolate(ni, pni, &page, 1);
+	ret = __tcache_lru_isolate(pni, &page, 1);
+	ni->nr_pages -= ret;
 	spin_unlock(&ni->lock);
 
 	if (!ret)



More information about the Devel mailing list