Re: 'disposable' dirty pages [was: Out Of Memory in v. 2.1]

Kenneth Albanowski (kjahds@kjahds.com)
Fri, 9 Oct 1998 12:33:10 -0400 (EDT)


On Fri, 9 Oct 1998, Jamie Lokier wrote:

> On Thu, Oct 08, 1998 at 10:50:14AM -0400, Kenneth Albanowski wrote:
> > Elegant. I proposed something related to the libc list a while ago
> > (calling mmap(/dev/zero) on large-enough released chunks of memory), but
> > this has the benefit of not making the VMA list grow for each release.
>
> Note, mmap(/dev/zero) ought not to make the VMA list grow either -- the
> memory is already in a zero-mapped VMA. I don't know if the VMA merging
> code is clever enough to notice the file offset is irrelevant in this
> case. It should be.

Curious. I had assumed that this would be interspersing VMAs, and thus
driving up the VMA list for each non-contiguous remap. If not, then
mmap(/dev/zero) should be of utility for releasing memory back to the OS,
separate from the discardable proposal.

(Unforunately, I don't have the foggiest idea whether the libc folks are
interested: when I mentioned this, ages ago, I don't recall anyone
grokking the concept, and I think it bogged down in folks telling me that
malloc already used mmap() for large allocations.)

> > I don't think it would make
> > sense to count the DISCARDABLE pages as actual free memory, as it isn't
> > available as such. Maybe another column in the memory report?
>
> It might be reasonable count them in the "cached" column.

'Cached' doesn't actually count to or against free memory, as I understand
it, and it woudn't be wise to change that.

'Buffers' almost has the right semantics -- except that I'd be ticked off
if the buffers column didn't actually count buffers.

> It's called kswapd, which already does that looking for pages to swap
> out. Reclaiming DISCARDABLE pages is very similar. Or am I mistaken?

No, that makes perfect sense. (I've been mired in archaic kernels for some
time, and kswapd didn't come readily to mind.)

> > > The process doesn't care whether any of those pages are discarded or
> > > not.
> >
> > Which isn't quite true, unfortunately. To make this true, the act of
> > making the page DISCARDABLE should also zero it.
>
> That's silly. You don't need DISCARDABLE to zero pages -- just zero-map
> them. If that makes a new VMA in malloc()ed memory, fix the kernel so
> it doesn't because it shouldn't.

Sorry, I seem to keep getting everyone confused with this one. I was
trying to say that if DISCARDABLE is to be an _exact_ replacement for
mmap(/dev/zero), then it must immediately zero the page. Strictly a matter
of keeping the semantics identical, given that one assumption.

As it's obviously useful to have different DISCARDABLE semantics, then
that assumption is not valid.

-- 
Kenneth Albanowski (kjahds@kjahds.com, CIS: 70705,126)

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/