Re: anonymous shared mmap. Where?

really kuznet@ms2.inr.ac.ru (inr-linux-kernel@ms2.inr.ac.ru)
26 Jul 1996 18:29:42 +0400


Linus Torvalds (torvalds@cs.helsinki.FI) wrote:
: It's definitely 2.1, if even that. Shared anonymous mmap is a monstrosity
: (even the name is a oxymoron), and it's hard to implement to boot.

: Use SysV shared memory

Sorry, not in this life, maybe in the following reincarnation 8)

: - it's _also_ a monstrosity (and hard to implement,
: but that part has been done already), but at least it has made a _try_ at
: making sense from a semantic viewpoint. I'd like to avoid shared anonymous
: mmap altogether, although with the current page cache it is at least possible
: to do sanely in theory.

Thanks. But what terrible did you find in shared anonymous mmap?

Well, I implemented it partially (swapping does not work, and you know why)
and can understand your attitude, but I cannot accept it!
The difficulties with swapping show that Linux vm manager
is not enough flexible, rather than that the mmap concept is wrong.

Please, note that SYSV shm (and even POSIX shm) can be easily
implemented on the top of true mmap, as it is done in FreeBSD, and
I believe, in other unices.

How I did it.
Unfortunately, shared mmap in Linux needs an attached inode.
(It is wrong, it should be another structure "vm_inode",
that keeps only vm related info: read_page, write_page etc.
and refers to a inode, if it really maps a fs object.)
Just for now, I create dummy inode with necessary ops.
The problem is that I cannot to swap out it, so that I just
protect such area from swapping.
Linux implementation SYSV shm has its own swapping mechanism. I hope,
you will not assure me, that it is correct.

As I understand, VM manager will be remade soon to use
write_page (else, I do not understand how you want to implement
NFS write cache). It would be good time to finish mmap.

I'd like to stress again: SYSV shm is just broken interface to mmap.

Alexey Kuznetsov.