Am 14.10.2011 03:33, schrieb Adam Carter:
> On Fri, Oct 14, 2011 at 12:29 PM, Adam Carter <adamcart...@gmail.com> wrote:
>>> In the kernel? What .config knob should I twiddle?
>>
>> Device Drivers -> Staging Drivers -> Compressed RAM block device
> 
> But Dynamic Compression of swap pages underneath looks interesting too
> (check the help).
> Compressed RAM block device = CONFIG_ZRAM
> Dynamic Compression of swap pages = CONFIG_ZCACHE
> 

Okay, so just to verify I understand this correctly (I doubt it):

Cleancache (not to be confused with compcache) is an intermediate layer
using a transcendent memory framework [6] for pages that can disappear
from the cache at any time. When the kernel has a clean page backed by
persistent memory (i.e. a file that has not been changed), instead of
removing the page from memory when the space is needed, it can push it
into cleancache. When the kernel later loads the page again, it checks
the cache to see if it is still there.[1,4]

Cleancache requires changes on the filesystem implementations. The
patches I've seen did not include any changes to Ext4 or others.
Somewhere it was mentioned that a generic hook was included so most
filesystems would immediately use it. However, the patches listed on
kernelnewbies.org did not include anything that looked like it so I
guess it was not included in 3.0. Therefore cleancache looks pretty
useless now but might be really neat in the future.

Frontswap, on the other hand, can be used for persistent pages (i.e.
"normal" anonymous memory for program data).[4] When the kernel would
normally swap out the page, it now presents it to frontswap and either
frontswap accepts the page (i.e. store it compressed in memory) or
refuses it (after which the kernel will really swap it out).[5]
Frontswap does not seem to be part of linux-3.0. The article at [4] says
it is somewhat controversial.

The difference between frontswap and cleancache is that cleancache
accepts everything but might not keep it while frontswap does not accept
everything but guarantees to keep it.

The slightly older zram implementation, on the other hand, uses the same
interface as a block device (which can be formatted as a swap device)
and therefore cannot decline an offered page like frontswap can. Zram
was easier to implement and to get accepted by the kernel community but
it is less efficient because it might save pages which are uncompressable.

Zcache is a backend used by frontswap and cleancache. It basically
reuses zram to offer a storage service for the transcendent memory
framework.[2,3] Another backend is implemented in Xen, using hypervisor
memory.[1]

Any remarks on that summary?

Regards,
Florian Philipp

[1]
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=4fe4746ab694690af9f2ccb80184f5c575917c7f

[2]
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=9cc06bf88d554dd527ded26eab28eec6a0d0e3df

[3] http://lwn.net/Articles/397574/

[4] http://lwn.net/Articles/386090/

[5] http://lwn.net/Articles/386103/

[6] https://lwn.net/Articles/340080/

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to