linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: Reward slab shrinkers that reclaim more than they were asked
@ 2017-08-12 11:34 Chris Wilson
  2017-08-15 22:30 ` Andrew Morton
  0 siblings, 1 reply; 11+ messages in thread
From: Chris Wilson @ 2017-08-12 11:34 UTC (permalink / raw)
  To: linux-mm
  Cc: intel-gfx, Chris Wilson, Andrew Morton, Michal Hocko,
	Johannes Weiner, Hillf Danton, Minchan Kim, Vlastimil Babka,
	Mel Gorman, Shaohua Li

Some shrinkers may only be able to free a bunch of objects at a time, and
so free more than the requested nr_to_scan in one pass. Account for the
extra freed objects against the total number of objects we intend to
free, otherwise we may end up penalising the slab far more than intended.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Hillf Danton <hillf.zj@alibaba-inc.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Shaohua Li <shli@fb.com>
Cc: linux-mm@kvack.org
---
 mm/vmscan.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index a1af041930a6..8bf6f41f94fb 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -398,6 +398,7 @@ static unsigned long do_shrink_slab(struct shrink_control *shrinkctl,
 			break;
 		freed += ret;
 
+		nr_to_scan = max(nr_to_scan, ret);
 		count_vm_events(SLABS_SCANNED, nr_to_scan);
 		total_scan -= nr_to_scan;
 		scanned += nr_to_scan;
-- 
2.13.3

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-08-28  8:09 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-12 11:34 [PATCH] mm: Reward slab shrinkers that reclaim more than they were asked Chris Wilson
2017-08-15 22:30 ` Andrew Morton
2017-08-15 22:53   ` Chris Wilson
2017-08-22 13:53   ` [PATCH 1/2] mm: Track actual nr_scanned during shrink_slab() Chris Wilson
2017-08-22 13:53     ` [PATCH 2/2] drm/i915: Wire up shrinkctl->nr_scanned Chris Wilson
2017-08-22 22:45       ` Andrew Morton
2017-08-23 14:20         ` Chris Wilson
2017-08-24  5:11     ` [PATCH 1/2] mm: Track actual nr_scanned during shrink_slab() Minchan Kim
2017-08-24  8:00       ` Vlastimil Babka
2017-08-25 21:41         ` Andrew Morton
2017-08-28  8:09         ` Minchan Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).