Re: [lkcd-devel] Re: What's left over.

Rob Landley
2002-11-07T00:19:57Z

On Wednesday 06 November 2002 04:07, Eric W. Biederman wrote:

> Personally I would love to be able to allocate one big contiguous
> buffer that the kernel is not using and neither is the image I will
> eventually load. Then I could just memcpy from that buffer and I
> would be done.
>
> Alas memory management in the kernel is done in pages, and can be
> fragmented after running for many moons. So I need to allocate all of
> my memory in pages, and I need to let the kernel know where it will
> all eventually live so I can correctly order the memcpy operations.

Reverse Mappings are cool, and one reason tehy're cool is, in theory, you can
grab a page of physical memory away from something else. In theory code
could be written to ask the kernel "could you please swap this the heck out,
pin the page in memory, and give it to me instead now?" And it can refuse
("it's already pinned by something else, maybe it's a kernel page, go away"),
it can block a bit ("gotta flush it to disk, wait until DMA is done"), or it
could immediatley comply ("it was a clean buffer, have it, keep it, stuff it
and mount it on the wall for all I care...").

This means you can retroactively get contiguous areas of memory by shoving
stuff aside. If it's in use, it'll swap back in immediately. (An obvious
optimization occurs, but that's not necessary for minimal functionality.)

So the the whole problem of needing contiguous areas of memory could, in
theory, be addressed using RMAP.

--
http://penguicon.sf.net - Terry Pratchett, Eric Raymond, Pete Abrams, Illiad,
CmdrTaco, liquid nitrogen ice cream, and caffienated jello. Well why not?