Skip to contentSkip to conversation

Cleancache: Documentation

PATCH Superseded Dan Magenheimer 2 participants 2 messages Jun 21, 2010 – Jun 22, 2010

Subsystems (6)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/8 Cleancache: Documentation

[PATCH V3 1/8] Cleancache: Documentation

Add cleancache documentation to Documentation/vm and sysfs ABI documentation to Documentation/ABI

Diffstat:

 ABI/testing/sysfs-kernel-mm-cleancache   |   11 +
 vm/cleancache.txt                        |  194 +++++++++++++++++++++
 2 files changed, 205 insertions(+)
Documentation/ABI/testing/sysfs-kernel-mm-cleancache +11 -0
@@ -0,0 +1,11 @@
+What:		/sys/kernel/mm/cleancache/
+Date:		June 2010
+Contact:	Dan Magenheimer <[email protected]>
+Description:
+		/sys/kernel/mm/cleancache/ contains a number of files which
+		record a count of various cleancache operations
+		(sum across all filesystems):
+			succ_gets
+			failed_gets
+			puts
+			flushes
Documentation/vm/cleancache.txt +194 -0

194 lines not on this page · raw message

#1 lore raw
Quoted 16 lines · On Mon, 21 Jun 2010 16:18:39 -0700 Dan Magenheimer wrote:

[PATCH V3 1/8] Cleancache: Documentation

Add cleancache documentation to Documentation/vm and sysfs ABI documentation to Documentation/ABI

Diffstat:

 ABI/testing/sysfs-kernel-mm-cleancache   |   11 +
 vm/cleancache.txt                        |  194 +++++++++++++++++++++
 2 files changed, 205 insertions(+)

Documentation/vm/cleancache.txt

Quoted 2 lines
Documentation/vm/cleancache.txt +1 -0
@@ -0,0 +1,194 @@
 
+A FAQ is included below:

FAQs are included below.

Documentation/vm/cleancache.txt line 43

Quoted 4 lines
Documentation/vm/cleancache.txt +3 -0
+
+IMPLEMENTATION OVERVIEW
 
+A "init_shared_fs", like init, obtains a pool id but tells cleancache

An "init_shared_fs" call, like init_fs,

Quoted 10 lines
Documentation/vm/cleancache.txt +10 -0
+to treat the pool as shared using a 128-bit UUID as a key.  On systems
+that may run multiple kernels (such as hard partitioned or virtualized
+systems) that may share a clustered filesystem, and where cleancache
+may be shared among those kernels, calls to init_shared_fs that specify the
+same UUID will receive the same pool id, thus allowing the pages to
+be shared.  Note that any security requirements must be imposed outside
+of the kernel (e.g. by "tools" that control cleancache).  Or a
+cleancache implementation can simply disable shared_init by always
+returning a negative value.
+

...

Documentation/vm/cleancache.txt line 94

Quoted 10 lines
Documentation/vm/cleancache.txt +10 -0
+FAQ
+
+1) Where's the value? (Andrew Morton)
+
+Cleancache (and its sister code "frontswap") provide interfaces for
+a new pseudo-RAM memory type that conceptually lies between fast
+kernel-directly-addressable RAM and slower DMA/asynchronous devices.
+Disallowing direct kernel or userland reads/writes to this pseudo-RAM
+is ideal when data is transformed to a different form and size (such
+as wiht compression) or secretly moved (as might be useful for write-

with

Quoted 6 lines
Documentation/vm/cleancache.txt +6 -0
+balancing for some RAM-like devices).  Evicted page-cache pages (and
+swap pages) are a great use for this kind of slower-than-RAM-but-much-
+faster-than-disk pseudo-RAM and the cleancache (and frontswap)
+"page-object-oriented" specification provides a nice way to read and
+write -- and indirectly "name" -- the pages.
+

...

Documentation/vm/cleancache.txt line 121

Quoted 7 lines
Documentation/vm/cleancache.txt +7 -0
+
+2) Why does cleancache have its sticky fingers so deep inside the
+   filesystems and VFS? (Andrew Morton and Christophe Hellwig)
+
+The core hooks for cleancache in VFS are in most cases a single line
+and the minimum set are placed precisely where needed to maintain
+coherency (via cleancache_flush operatings) between cleancache,

operations ?

Documentation/vm/cleancache.txt line 130

Quoted 9 lines
Documentation/vm/cleancache.txt +9 -0
+the page cache, and disk.  All hooks compile into nothingness if
+cleancache is config'ed off and turn into a function-pointer-
+compare-to-NULL if config'ed on but no backend claims the ops
+functions, or to a compare-struct-element-to-negative if a
+backend claims the ops functions but a filesystem doesn't enable
+cleancache.
+
+Some filesystems are built entirely on top of VFS and the hooks
+in VFS are sufficient, so don't require a "init_fs" hook; the

an

Quoted 15 lines
Documentation/vm/cleancache.txt +15 -0
+initial implementation of cleancache didn't provide this hook.
+But for some filesystems (such as btrfs), the VFS hooks are
+incomplete and one or more hooks in fs-specific code are required.
+And for some other filesystems, such as tmpfs, cleancache may
+be counterproductive.  So it seemed prudent to require a filesystem
+to "opt in" to use cleancache, which requires adding a hook in
+each filesystem.  Not all filesystems are supported by cleancache
+only because they haven't been tested.  The existing set should
+be sufficient to validate the concept, the opt-in approach means
+that untested filesystems are not affected, and the hooks in the
+existing filesystems should make it very easy to add more
+filesystems in the future.
+
+3) Why not make cleancache asynchronous and batched so it can
+   more easily interface with real devices with DMA instead

Documentation/vm/cleancache.txt line 155

Quoted 10 lines
Documentation/vm/cleancache.txt +10 -0
+   of copying each individual page? (Minchan Kim)
+
+The one-page-at-a-time copy semantics simplifies the implementation
+on both the frontend and backend and also allows the backend to
+do fancy things on-the-fly like page compression and
+page deduplication.  And since the data is "gone" (copied into/out
+of the pageframe) before the cleancache get/put call returns,
+a great deal of race conditions and potential coherency issues
+are avoided.  While the interface seems odd for a "real device"
+or for real kernel-addressible RAM, it makes perfect sense for

kernel-addressable

Quoted 1 line

+pseudo-RAM.

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>