Re: [RFC][PATCH] Anonymous shared memory (ashmem) subsystem

From: Dave Hansen
Date: Tue Jul 19 2011 - 11:38:25 EST


On Mon, 2011-07-18 at 23:36 -0400, Christoph Hellwig wrote:
> > But yes, tmpfs
> > already solved the problem of getting a shared-memory file descriptor
> > - just open a random-name file in tmpfs, unlink it, and start passing
> > it around.
>
> Indeed. And as mentioned before using /dev/zero as the file will
> get you a pre-unlinked tmpfs fd without any races, and without the
> need of actually mounting shmem into any namespace.

"Why not use tmpfs?" was my gut reaction, too. The patch is named a bit
unfortunately, but I think the key bit in them is the "volatile" pages,
not the "anonymous" or "shared memory" features.

Those let userspace allocate things like caches, and lets the kernel
destructively (but safely) reclaim them when there's memory pressure
(implemented as a slab shrinker here). It's kinda like a kernel-driven
garbage collector, or even like a distant relative of those CMM2 patches
from the s390 folks a few years ago.

This implementation has some real show-stopper things in it, like its
own LRU. But, the concept seems interesting at least.

-- Dave

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