Cleancache: shim to Xen Transcendent Memory
Subsystems (5)
PATCH v5 1/1 Cleancache: shim to Xen Transcendent Memory
[PATCH V5] Cleancache: shim to Xen Transcendent Memory
Changes from V0 to V5:
- uses new in-kernel cleancache API to match cleancache V5 patch
- uses new Xen tmem ABI (v1) just pushed upstream to Xen (skipped V1-V4 to match cleancache version numbers)
This companion patch to the cleancache V5 patchset (see
http://lkml.org/lkml/2010/9/3/383) provides one consumer for the proposed cleancache internal kernel API. This user is Xen Transcendent Memory ("tmem"), supported in Xen 4.0+. (A second user, zmem, was separately posted by Nitin Gupta and is not yet updated to cleancache V5.)
This patch affects Xen directories only; while broader review is welcome, the patch is provided primarily to answer concerns expressed about the apparent non-existence of consumers for the proposed cleancache patch.
Xen tmem provides "hypervisor RAM" as an ephemeral page-oriented pseudo-RAM store for cleancache pages, shared cleancache pages, and frontswap pages. Tmem provides enterprise-quality concurrency, full save/restore and live migration support, compression and deduplication.
A presentation showing up to 8% faster performance and up to 52% reduction in sectors read on a kernel compile workload, despite aggressive in-kernel page reclamation ("self-ballooning") can be found at:
Diffstat:
arch/x86/include/asm/xen/hypercall.h | 7 drivers/xen/Makefile | 1 drivers/xen/tmem.c | 264 +++++++++++++++++++++ include/xen/interface/xen.h | 22 + 4 files changed, 294 insertions(+)
arch/x86/include/asm/xen/hypercall.h +7 -0
@@ -423,6 +423,13 @@ HYPERVISOR_hvm_op(int op, void *arg) return _hypercall2(unsigned long, hvm_op, op, arg); } +static inline int +HYPERVISOR_tmem_op ( +struct tmem_op *op) +{ +return _hypercall1 (int, tmem_op, op); +} +static inline void MULTI_fpu_taskswitch (struct multicall_entry *mcl,int set) {
drivers/xen/Makefile +1 -0
@@ -1,5 +1,6 @@ obj-y += grant-table.o features.o events.o manage.o obj-y += xenbus/ +obj-y += tmem.o nostackp := $(call cc-option, -fno-stack-protector) CFLAGS_features.o := $(nostackp)
drivers/xen/tmem.c +264 -0
264 lines not on this page · raw message
include/xen/interface/xen.h +22 -0
@@ -58,6 +58,7 @@#define __HYPERVISOR_event_channel_op 32#define __HYPERVISOR_physdev_op 33#define __HYPERVISOR_hvm_op 34 +#define __HYPERVISOR_tmem_op 38/* Architecture-specific hypercall definitions. */ #define __HYPERVISOR_arch_0 48
@@ -461,6 +462,27 @@ typedef uint8_t xen_domain_handle_t[16];#define __mk_unsigned_long (x) x ## UL#define mk_unsigned_long (x) __mk_unsigned_long(x) +#define TMEM_SPEC_VERSION 1 + +struct tmem_op { +uint32_t cmd; +int32_t pool_id; +union { +struct {/* for cmd == TMEM_NEW_POOL */ +uint64_t uuid[2 ]; +uint32_t flags; + } new; +struct { +uint64_t oid[3 ]; +uint32_t index; +uint32_t tmem_offset; +uint32_t pfn_offset; +uint32_t len; +GUEST_HANDLE (void ) gmfn;/* guest machine page frame */ + } gen; + } u; +}; +#else /* __ASSEMBLY__ */ /* In assembly code we cannot use C numeric constant suffixes. */
fs/ocfs2/super.c +3 -0
@@ -42,6 +42,7 @@#include <linux/seq_file.h> #include <linux/quotaops.h> #include <linux/smp_lock.h> +#include <linux/cleancache.h> #define MLOG_MASK_PREFIX ML_SUPER#include <cluster/masklog.h>
@@ -2284,6 +2285,8 @@ static int ocfs2_initialize_super(structmlog_errno (status); goto bail; } + sb->cleancache_poolid = +cleancache_init_shared_fs ((char *)&uuid_net_key,PAGE_SIZE ); bail:mlog_exit (status);