[Devel] [PATCH RHEL7 COMMIT] tcache: Refactor tcache_shrink_scan()
Konstantin Khorenko
khorenko at virtuozzo.com
Wed Jan 31 15:59:13 MSK 2018
The commit is pushed to "branch-rh7-3.10.0-693.11.6.vz7.42.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-693.11.6.vz7.42.3
------>
commit 358afa53127ff3a3b215e525a9e70f3754f596c1
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date: Wed Jan 31 15:59:13 2018 +0300
tcache: Refactor tcache_shrink_scan()
Make the function have the only return.
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
Acked-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
mm/tcache.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/mm/tcache.c b/mm/tcache.c
index 9710531731ab..f1cc664a2ce3 100644
--- a/mm/tcache.c
+++ b/mm/tcache.c
@@ -1199,24 +1199,24 @@ static DEFINE_PER_CPU(struct page * [TCACHE_SCAN_BATCH], tcache_page_vec);
static unsigned long tcache_shrink_scan(struct shrinker *shrink,
struct shrink_control *sc)
{
- struct page **pages = get_cpu_var(tcache_page_vec);
- int nr_isolated, nr_reclaimed;
+ long nr_isolated, nr_reclaimed;
+ struct page **pages;
+
+ pages = get_cpu_var(tcache_page_vec);
if (WARN_ON(sc->nr_to_scan > TCACHE_SCAN_BATCH))
sc->nr_to_scan = TCACHE_SCAN_BATCH;
nr_isolated = tcache_lru_isolate(sc->nid, pages, sc->nr_to_scan);
if (!nr_isolated) {
- put_cpu_var(tcache_page_vec);
- return SHRINK_STOP;
+ nr_reclaimed = SHRINK_STOP;
+ goto out;
}
-
nr_reclaimed = tcache_reclaim_pages(pages, nr_isolated);
- put_cpu_var(tcache_page_vec);
-
if (current->reclaim_state)
current->reclaim_state->reclaimed_slab += nr_reclaimed;
-
+out:
+ put_cpu_var(tcache_page_vec);
return nr_reclaimed;
}
More information about the Devel
mailing list