Re: Major XFS problems...

From: Andrew Morton
Date: Thu Sep 09 2004 - 03:13:31 EST


Dave Chinner <dgc@xxxxxxx> wrote:
>
> If the dentry_stat.nr_unused is less than 100, then we'll return 0
> due to integer division (99/100 = 0), and the shrinker calculations
> will see this as a slab that does not need shrinking because:
>
> 185 list_for_each_entry(shrinker, &shrinker_list, list) {
> 186 unsigned long long delta;
> 187
> 188 delta = (4 * scanned) / shrinker->seeks;
> 189 delta *= (*shrinker->shrinker)(0, gfp_mask);
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 190 do_div(delta, lru_pages + 1);
> 191 shrinker->nr += delta;
> 192 if (shrinker->nr < 0)
> 193 shrinker->nr = LONG_MAX; /* It wrapped! */
> 194
> 195 if (shrinker->nr <= SHRINK_BATCH)
> 196 continue;
>
> because we returned zero and therefore delta becomes zero and
> shrinker->nr never gets larger than SHRINK_BATCH.
>
> Hence in low memory conditions when you've already reaped most of
> the unused dentries, you can't free up the last 99 unused dentries.
> Maybe this is intentional (anyone?) because there isn't very much to
> free up in this case, but some memory freed is better than none when
> you have nothing at all left.

Yes, it's intentional. Or at least, it's known-and-not-cared about ;)

The last 99 unused dentries will not be reaped.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/