[Devel] [PATCH rh7] tcache: account reclaimed pages to scan_control->nr_reclaimed

Vladimir Davydov vdavydov at virtuozzo.com
Tue Nov 17 06:13:33 PST 2015


Tcache pages might constitute a substantial portion of the total number
of pages reclaimed. Since they are freed immediately, we should count
them to scan_control->nr_reclaimed to avoid premature scan->priority
drops and resulting overreclaim.

Signed-off-by: Vladimir Davydov <vdavydov at virtuozzo.com>
---
 mm/tcache.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/mm/tcache.c b/mm/tcache.c
index ce5b0edd8253..e8ffa91190e6 100644
--- a/mm/tcache.c
+++ b/mm/tcache.c
@@ -17,6 +17,7 @@
 #include <linux/completion.h>
 #include <linux/shrinker.h>
 #include <linux/vmstat.h>
+#include <linux/swap.h>
 #include <linux/cleancache.h>
 
 /* cleancache_put_page is called from atomic context */
@@ -808,6 +809,8 @@ static unsigned long tcache_shrink_scan(struct shrinker *shrink,
 		}
 		sc->nr_to_scan--;
 	}
+	if (current->reclaim_state)
+		current->reclaim_state->reclaimed_slab += nr_reclaimed;
 	return nr_reclaimed;
 }
 
-- 
2.1.4



More information about the Devel mailing list