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

Peter Zijlstra
2007-11-15T21:27:36Z

On Thu, 2007-11-15 at 13:14 -0800, Linus Torvalds wrote:
>
> On Thu, 15 Nov 2007, Linus Torvalds wrote:
> >
> > Unacceptable. We used to do exactly what your patch does, and it got fixed
> > once. We're not introducing that fundamentally broken concept again.
>
> Examples of non-broken solutions:
> (a) always use lowmem sizes (what we do now)
> (b) always use total mem sizes (sane but potentially dangerous: but the
> VM pressure should work! It has serious bounce-buffer issues, though,
> which is why I think it's crazy even if it's otherwise consistent)
> (c) make all dirty counting be *purely* per-bdi, so that everybody can
> disagree on what the limits are, but at least they also then use
> different counters

I think that (c) is doable. If its worth the effort, who knows,
apparently there still are people using 32bit kernels on boxen with
mucho memory.

> So it's just the "different writers look at the same dirty counts but then
> interpret it to mean totally different things" that I think is so
> fundamentally bogus. I'm not claiming that what we do now is the only way
> to do things, I just don't think your approach is tenable.

Agreed, the per mapping thing was utter crap.

> I'd also like to point out that while the "bounce buffer" issue is not so
> much a HIGHMEM issue on its own (it's really about the device DMA limits,
> which are _independent_ of HIGHMEM, of course), the reason HIGHMEM is
> special is that without HIGHMEM the bounce buffers generally work
> perfectly fine.
>
> The problem with HIGHMEM is that it causes various metadata (dentries,
> inodes, page struct tables etc) to eat up memory "prime real estate" under
> the same kind of conditions that also dirty a lot of memory. So the reason
> we disallow HIGHMEM from dirty limits is only *partly* the per-device or
> mapping DMA limits, and to a large degree the fact that non-highmem memory
> is special in general, and it is usually the non-highmem areas that are
> constrained - and need to be protected.

But this problem is already an issue, Anton recently had a case where a
12GB highmem box locked up due to NTFS running out of lowmem - or
something like that.

And I think that with the targeted slab reclaim (or slab defrag as its
apparently still called) we can properly fix this side of the problem. I
think Rik was looking into doing so.