Re: [QUESTION] Filesystem like structure in RAM w/o using filesystem (not ramdisk)

From: Rob Landley
Date: Mon Dec 05 2005 - 11:00:41 EST


On Thursday 01 December 2005 05:45, Indrek Kruusa wrote:
> Hello!
>
> As I have understood the accessing ramdisk goes through the same kernel
> path which is meant for accessing slow block device (i_nodes caching etc.).
> Is there any other common way (some API above shared memory?) to
> create/open/read/write globally accessible hierarchical datablocks in RAM?
> Could it be possibly faster than ramdisk?

You can use ramfs which stores data in the page cache (no block device backing
it, and no filesystem driver). That's about as simple as you're going to
get.

An expanded version of ramfs is tmpfs. This allows you to set size limits
(which you need to allow anybody other than root write access to one of these
things; otherwise you can fill up memory and trivially bring down the
system), and also allows the data to be swapped out (ramfs pins the dirty
pages in memory, since there's no backing block device for it to be flushed
to it just vetoes all attempts to do so. Tmpfs substitutes the normal swap
mechanism, whatever swap partitions or swap files you've set up.)

I have no idea what would happen if you tried to enable a swap file on a tmpfs
mount, but since only root could be try that particular bit of peversity,
it's almost certainly a "don't do that then"...

> Thanks in advance,
> Indrek

Rob
--
Steve Ballmer: Innovation! Inigo Montoya: You keep using that word.
I do not think it means what you think it means.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/