Re: mmap dirty limits on 32 bit kernels (Was: [BUG] New Kernel Bugs)

Linus Torvalds
2007-11-15T20:57:19Z

On Thu, 15 Nov 2007, Peter Zijlstra wrote:
>
> Something like this ought to do I guess. Although my
> mapping_is_buffercache() is the ugliest thing. I'm sure that can be done
> better.

No, this absolutely sucks.

Why?

It's totally unacceptable to have per-mapping notions of how much memory
we have. We used to do *exactly* that, and it's idiocy.

The reason it's unacceptable idiocy is that it means that two processes
that access different files will then have *TOTALLY*DIFFERENT* notions of
what the "dirty limit" is. And as a result, one process will happily write
lots and lots of dirty stuff and never throttle, and the other process
will have to throttle all the time - and clean up after the process that
didn't!

See?

The fact is, because we count dirty pages as one resource, we must also
have *one* limit.

So this patch is a huge regression. You might not notice it, because if
everybody writes to the same kind of mapping, nobody will be hurt (they
all have effectively the same global limit anyway), but you *will* notice
if you ever have two different values of "highmem".

Unacceptable. We used to do exactly what your patch does, and it got fixed
once. We're not introducing that fundamentally broken concept again.

Linus