[Devel,RHEL7,COMMIT] tcache: Delete duplicate cycle iteration variable

Submitted by Konstantin Khorenko on Aug. 11, 2017, 2:25 p.m.

Details

Message ID 201708111425.v7BEP50V005111@finist_cl7.x64_64.work.ct
State New
Series "tcache: Delete duplicate cycle iteration variable"
Headers show

Commit Message

Konstantin Khorenko Aug. 11, 2017, 2:25 p.m.
The commit is pushed to "branch-rh7-3.10.0-514.26.1.vz7.35.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-514.26.1.vz7.35.3
------>
commit 3d4cf4c7240edad3baa86d25c137f02249e3c699
Author: Kirill Tkhai <ktkhai@virtuozzo.com>
Date:   Fri Aug 11 18:25:05 2017 +0400

    tcache: Delete duplicate cycle iteration variable
    
    Initially, nr_scanned == nr_to_isolate, but in futher
    nr_scanned may decreese faster, i.e., in any time
    nr_scanned <= nr_to_isolate.
    
    The check, we do in while (), is:
    
    nr_scanned > 0 && nr_to_isolate > 0
    
    and it may be reduced to nr_scanned > 0 because of above.
    So, do that, and rename nr_scanned in nr_to_scan, because
    it better fits to its physical sence.
    
    Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 mm/tcache.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/mm/tcache.c b/mm/tcache.c
index 0835e29..0bfbb69 100644
--- a/mm/tcache.c
+++ b/mm/tcache.c
@@ -990,14 +990,13 @@  __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,
-		     struct page **pages, int nr_to_isolate)
+		     struct page **pages, int nr_to_scan)
 {
 	struct tcache_node *node;
 	struct page *page;
 	int nr_isolated = 0;
-	int nr_scanned = nr_to_isolate;
 
-	while (nr_to_isolate > 0 && !list_empty(&pni->lru) && nr_scanned--) {
+	while (nr_to_scan-- > 0 && !list_empty(&pni->lru)) {
 		page = list_first_entry(&pni->lru, struct page, lru);
 
 		if (unlikely(!page_cache_get_speculative(page)))
@@ -1017,7 +1016,6 @@  __tcache_lru_isolate(struct tcache_nodeinfo *ni,
 		tcache_hold_pool(node->pool);
 
 		pages[nr_isolated++] = page;
-		nr_to_isolate--;
 	}
 	return nr_isolated;
 }