]> git.hungrycats.org Git - linux/commitdiff
[PATCH] shrink_slab acounts for seeks incorrectly
authorAndrew Morton <akpm@osdl.org>
Tue, 30 Dec 2003 07:48:44 +0000 (23:48 -0800)
committerLinus Torvalds <torvalds@home.osdl.org>
Tue, 30 Dec 2003 07:48:44 +0000 (23:48 -0800)
wli points out that shrink_slab inverts the sense of shrinker->seeks: those
caches which require more seeks to reestablish an object are shrunk harder.
That's wrong - they should be shrunk less.

So fix that up, but scaling the result so that the patch is actually a no-op
at this time, because all caches use DEFAULT_SEEKS (2).

mm/vmscan.c

index b8594827bbac1a6e719ea1685fe10efaebce0cb1..f2da3c9fb34673a85648f230a1607fde67908fa5 100644 (file)
@@ -154,7 +154,7 @@ static int shrink_slab(long scanned, unsigned int gfp_mask)
        list_for_each_entry(shrinker, &shrinker_list, list) {
                unsigned long long delta;
 
-               delta = scanned * shrinker->seeks;
+               delta = 4 * (scanned / shrinker->seeks);
                delta *= (*shrinker->shrinker)(0, gfp_mask);
                do_div(delta, pages + 1);
                shrinker->nr += delta;