On Wed, Feb 20, 2019 at 06:27:07PM +1100, Dave Chinner wrote: > freeable = 1 > > ratio 4.15 priority 4.16 4.18 new > 1:100 1 12 0 batch 1 > 1.32 1 9 0 batch 1 > 1:12 1 6 0 batch 1 > 1:6 1 3 0 batch 1 > 1:1 1 1 1 batch 1 > @@ -479,7 +479,16 @@ static unsigned long do_shrink_slab(struct shrink_control *shrinkctl, > > total_scan = nr; > if (shrinker->seeks) { > - delta = freeable >> priority; > + /* > + * Use a small non-zero offset for delta so that if the scan > + * priority is low we always accumulate some pressure on caches > + * that have few freeable objects in them. This allows light > + * memory pressure to turn over caches with few freeable objects > + * slowly without the need for memory pressure priority to wind > + * up to the point where (freeable >> priority) is non-zero. > + */ > + delta = ilog2(freeable); The idea makes sense to me, but log2 fails us when freeable is 1. fls() should work, though. > + delta += freeable >> priority; > delta *= 4; > do_div(delta, shrinker->seeks); > } else {