Re: Memory Mapped Filesystem

From: Christoph Rohland (hans-christoph.rohland@sap.com)
Date: Wed Mar 22 2000 - 05:16:40 EST


Jamie Lokier <lk@tantalophile.demon.co.uk> writes:
> Thomas Pornin wrote:
> > Therefore, I intend to implement such a filesystem. For this, I need
> > some help; specifically, I ask myself the following questions:
> > -- does such a filesystem already exists ?
>
> Nearly. The recently added shmfs handles the memory management
> issues and, being widely used, will get fairly thorough testing.

There is one issue missing in shm fs mm for real tmpfs usage: We
cannot do private writeable mappings. This is probably something we
get when we rework the shm stuff to use the page cache.

> > -- would it be easier to modify the ramdisk to be able to be
> > swapped out, and stubs in one filesystem to unmap unused pages ?
> > -- how do I allocate memory from within the kernel, such that this
> > memory might be swapped out ? I can do a do_mmap(), but, from
> > my (rather low) understanding of the memory management in Linux,
> > this mapping would be specific to one process. I could run
> > a kernel thread (well, at least I believe I could) but I would
> > run into the "Minix-single-threaded-filesystem".
> > -- does all this make sense ? Is there a better solution ?
>
> Most of what you ask has been carefully implemented for shmfs, except
> for the filesystem part :-)
>
> I.e., memory files were effectively added recently. However, I think
> for tmpfs you need to add read/write support (shmfs only does mmap I
> think), some way to extend/truncate the files, and a directory
> structure.

Yes read/write, special files and directories are missing.

ftruncate is working but has to be better for write support. This also
should be easy after integration into the page cache.

The directory handling stuff is a bigger task which would be needed
for tmpfs: The shm fs is now directly tied to the SYSV IPC structure
which does not fit for hierarchical file handling. If we had a real
directory handling we would also win the ability to mount it several
times.

> > -- what happens if I create a file on such a filesystem and try to
> > swapon it ?
>
> Only one way to find out :-)

I would imagine a really nice lockup :-)

Greetings
                Christoph

-
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/



This archive was generated by hypermail 2b29 : Thu Mar 23 2000 - 21:00:35 EST