Commit c3f46561 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] shrink_slab acounts for seeks incorrectly

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).
parent 4be16e54
...@@ -154,7 +154,7 @@ static int shrink_slab(long scanned, unsigned int gfp_mask) ...@@ -154,7 +154,7 @@ static int shrink_slab(long scanned, unsigned int gfp_mask)
list_for_each_entry(shrinker, &shrinker_list, list) { list_for_each_entry(shrinker, &shrinker_list, list) {
unsigned long long delta; unsigned long long delta;
delta = scanned * shrinker->seeks; delta = 4 * (scanned / shrinker->seeks);
delta *= (*shrinker->shrinker)(0, gfp_mask); delta *= (*shrinker->shrinker)(0, gfp_mask);
do_div(delta, pages + 1); do_div(delta, pages + 1);
shrinker->nr += delta; shrinker->nr += delta;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment