Re: [test patch] dirty shared mappings (was Re: ... fragmentation)

Linus Torvalds (torvalds@transmeta.com)
Wed, 7 Jan 1998 15:59:39 -0800 (PST)


On Thu, 8 Jan 1998, Alan Cox wrote:
>
> > No, they don't all have to be clean, it's just that we'd have to have some
> > way of allocating pages for the inode for backing store (so that we can do
> > a page-out() to the right location). Essentially, the page area moves from
> > being just a anonymous linear area of pages for swap into having some
> > structure, which is obviously painful. I think it's probably the right
> > thing to do, but I don't really have a good idea on _how_ to do it..
>
> Is there any reason you can't simply invent a device with an mmap method
> to attach an inode too for anonymous maps so that they cease to be anonymous ?

That works and is the simple solution, but then you would essentially have
a _separate_ swap area for anonymous maps. That may be good enough, and
it's certainly the simple solution.

The traditional UNIX solution as far as I know is to have the anonymous
mappings be backed in the general swapfile, and then the problem is one of
trying to keep track of which entries are used for shared anonymous pages
and which are used for private anonymous pages (and giving a number to the
shared anonymous ones).

Having a separate swap area for shared anonymous pages would certainly
make sense, and would get rid of all the problems, but would require the
machine to be set up correctly that way by somebody (essentially it turns
the anonymous shared mappings to a real shared mapping of a special
"magic" object - which can be either a real file or a partition or
something, but the point is that the "something" will have to be set up by
the maintainer of the machine rather than being the global swap device).

Would that be acceptable to people?

Linus