[Devel] [PATCH rh7] tcache: Delete duplicate cycle iteration variable
Kirill Tkhai
ktkhai at virtuozzo.com
Thu Aug 10 13:36:28 MSK 2017
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 at virtuozzo.com>
---
mm/tcache.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/mm/tcache.c b/mm/tcache.c
index 458d3c45b6a..aaf906e3dd3 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;
}
More information about the Devel
mailing list