Re: [patch, feature] nonlinear mappings, prefaulting support, 2.5.42-F8

Linus Torvalds
2002-10-15T06:48:41Z

On Tue, 15 Oct 2002, Jamie Lokier wrote:
>
> I like the SIGBUS. Am I correct to assume that, when there is memory
> pressure, some pages are evicted from memory and all accesses to those
> pages from userspace will raise SIBUS until the mapping is
> reastablished? Am I correct to assume this works fine on /dev/shm files?

It should work fine, assuming the shm interface has a "populate" macro.

The only real problem I think the interface has is that the nonlinear
mappings cannot have private pages in them - because while the MM would be
happy to swap them out, there is no sane way to get them back.

The private page information actually does exist in the page tables, but
the _protection_ does not. That's in the VMA, and since one of the whole
points with the nonlinear mapping is that the VMA is "anonymous", we're
kind of screwed.

As it is, you cannot really even add private pages to the linear mapping:
all the page add interfaces are for shared pages only. But I could imagine
that it could be useful to have a "add private page here".

(The "add private page here" interface might also have a "use previous
page if one existed" method, in which case the SIGBUS handler could just
use that one, and thus generate the protection information on the fly -
while generating the actual swap-in data from the page table entry itself)

Ingo - what do you think? I suspect a anonymous ("swap-backed" as opposed
to "backed by this file") interface might be quite useful.

Linus