Re: [RFC][PATCH] mm: reorder balance_dirty_pages to improve (some)write performance

From: Andrew Morton
Date: Mon Jul 27 2009 - 18:58:55 EST


On Fri, 24 Jul 2009 15:28:37 +0100
Richard Kennedy <richard@xxxxxxxxxxxxxxx> wrote:

> Reorder balance_dirty_pages to do less work in the default case &
> improve write performance in some cases.
>
> Running simple fio mmap write tests on x86_64 with 3gb of memory on
> 2.6.31-rc3 where each test was run 10 times, dropping the slowest &
> fastest results the average write speeds are
>
> size rc3 | +patch difference
> MiB/s (s.d.)
>
> 400m 374.75 ( 8.15) | 382.575 ( 8.24) + 7.825
> 500m 363.625 (10.91) | 378.375 (10.86) +14.75
> 600m 308.875 (10.86) | 374.25 ( 7.91) +65.375
> 700m 188 ( 4.75) | 209 ( 7.23) +21
> 800m 140.375 ( 2.56) | 154.5 ( 2.98) +14.275
> 900m 124.875 ( 0.99) | 125.5 ( 9.62) +0.625
>
>
> This patch helps write performance when the test size is close to the
> allowed number of dirty pages (approx 600m on this machine). Once the
> test size becomes larger than 900m there is no significant difference.
>
>
> Signed-off-by: Richard Kennedy <richard@xxxxxxxxxxxxxxx>
> ----
>
> This change only make a difference to workloads where the number of
> dirty pages is close to (dirty_ratio * memory size). Once a test writes
> more than that the speed of the disk is the most important factor so any
> effect of this patch is lost.
> I've only tried this on my desktop, so it really needs testing on
> different hardware.
> Does anyone feel like trying it ?

So what does the patch actually do?

AFACIT the main change is to move this:

if (bdi->dirty_exceeded)
bdi->dirty_exceeded = 0;

from after the loop and into the body of the loop.

So that we no longer clear dirty_exceeded in the three other places
where we break out of the loop.

IOW, dirty_exceeded can be left true (even if it shouldn't be?) on exit
from balance_dirty_pages().

What was the rationale for leaving dirty_exceeded true in those cases,
and why did it speed up that workload?

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