Re: bdi_min_ratio never shrinks, ultimately preventing validsetting of min_ratio

From: Peter Zijlstra
Date: Thu Jun 02 2011 - 07:42:26 EST


It really helps if you CC the relevant people.

On Tue, 2011-05-31 at 19:28 -0500, lkml@xxxxxxxxxxx wrote:
> mm/page-writeback.c
> There is a static global bdi_min_ratio used for policing the setting of
> per-bdi min_ratio's, to ensure the sum doesn't cross 100.
>
> There is no place in this listing where the value is decremented by the
> respective bdi's min_ratio when a bdi is torn down.

There is, adding a negative number is equal to a subtraction.

min_ratio -= bdi->min_ratio;
if (bdi_min_ratio + min_ratio < 100) {
bdi_min_ratio += min_ratio;
bdi->min_ratio += min_ratio;
}

is the relevant piece, note that bdi->min_ratio is the current setting,
this makes min_ratio the difference between the new and old setting, and
adding this to both bdi_min_ratio (the global sum) and bdi->min_ratio
dtrt regardless if the new value is larger or smaller than the old
value.

> This looks like a bug
> to me, and I have a situation where I'm unable to set a min_ratio to 1
> where the sum of /sys/class/bdi/*/min_ratio does not add up to 100, which
> is what triggered this investigation.

Which of the two -EINVAL cases is triggered?

--
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/