Re: Change in default vm_dirty_ratio

Linus Torvalds
2007-06-20T18:28:31Z

On Wed, 20 Jun 2007, Arjan van de Ven wrote:
>
> maybe that needs to be fixed? If you stopped dirtying after the initial
> bump.. is there a reason for the kernel to dump all that data to the
> disk in such a way that it disturbs interactive users?

No. I would argue that the kernel should try to trickle things out, so
that it doesn't disturb anything, and a "big dump" becomes a "steady
trickle".

And that's what "vm_dirty_ratio" is all about.

> so the question maybe is.. is the vm tunable the cause or the symptom of
> the bad experience?

No, the vm tunable is exactly what it's all about.

Do a big "untar", and what you *want* to see is not "instant dump,
followed by long pause".

A much *smoother* behaviour is generally preferable, and most of the time
that's true even if it may be lower throughput in the end!

Of course, "synchronous writes" are *really* smooth (you never allow any
dumps at *all* to build up), so this is about a balance - not about
"perfect smoothness" vs "best throughput", but about a heuristic that
finds a reasonable middle ground.

There is no "perfect". There is only "stupid heuristics". Maybe the
"vm_dirty_ratio" is a bit *too* stupid, but it definitely is needed in
some form.

It can actually be more than just a "performance" vs "smoothness" issue:
the 40% thing was actually a *correctness* issue too, back when we coutned
it as a percentage of total memory. A highmem machine would allow 40% of
all memory free and it was all in low memory, and that literally caused
lockups.

So the dirty_ratio is not *only* about smoothness, it's also simply about
the fact that the kernel must not allow too much memory to be dirtied,
because that leads to out-of-memory deadlocks and other nasty issues. So
it's not *purely* a tunable.

Linus