Re: [PATCH 13/18] writeback: limit max dirty pause time

From: Peter Zijlstra
Date: Tue Sep 06 2011 - 10:52:32 EST


On Sun, 2011-09-04 at 09:53 +0800, Wu Fengguang wrote:

> +static unsigned long bdi_max_pause(struct backing_dev_info *bdi,
> + unsigned long bdi_dirty)
> +{
> + unsigned long hi = ilog2(bdi->write_bandwidth);
> + unsigned long lo = ilog2(bdi->dirty_ratelimit);
> + unsigned long t;
> +
> + /* target for ~10ms pause on 1-dd case */
> + t = HZ / 50;

1k/50 usually ends up being 20 something

> + /*
> + * Scale up pause time for concurrent dirtiers in order to reduce CPU
> + * overheads.
> + *
> + * (N * 20ms) on 2^N concurrent tasks.
> + */
> + if (hi > lo)
> + t += (hi - lo) * (20 * HZ) / 1024;
> +
> + /*
> + * Limit pause time for small memory systems. If sleeping for too long
> + * time, a small pool of dirty/writeback pages may go empty and disk go
> + * idle.
> + *
> + * 1ms for every 1MB; may further consider bdi bandwidth.
> + */
> + if (bdi_dirty)
> + t = min(t, bdi_dirty >> (30 - PAGE_CACHE_SHIFT - ilog2(HZ)));

Yeah, I would add the bdi->avg_write_bandwidth term in there, 1g/s as an
avg bandwidth is just too wrong..


> +
> + /*
> + * The pause time will be settled within range (max_pause/4, max_pause).
> + * Apply a minimal value of 4 to get a non-zero max_pause/4.
> + */
> + return clamp_val(t, 4, MAX_PAUSE);

So you limit to 50ms min? That still seems fairly large. Is that because
your min sleep granularity might be something like 10ms since you're
using jiffies?

> +}


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