Skip to contentSkip to conversation

xen: cleancache shim to Xen Transcendent Memory

PATCH In review Dan Magenheimer 3 participants 6 messages Apr 14, 2011 – Apr 18, 2011

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen: cleancache shim to Xen Transcendent Memory

[PATCH] xen: cleancache shim to Xen Transcendent Memory

This patch provides a shim between the kernel-internal cleancache API (see Documentation/mm/cleancache.txt) and the Xen Transcendent Memory ABI (see http://oss.oracle.com/projects/tmem).

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:

http://oss.oracle.com/projects/tmem/dist/documentation/presentations/TranscendentMemoryXenSummit2010.pdf

Cc Konrad Rzeszutek Wilk <[email protected]>
Cc Matthew Wilcox <[email protected]>
Cc Nick Piggin <[email protected]>
Cc Mel Gorman <[email protected]>
Cc Rik Van Riel <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Chris Mason <[email protected]>
Cc Andreas Dilger <[email protected]>
Cc Ted Ts'o <[email protected]>
Cc Mark Fasheh <[email protected]>
Cc Joel Becker <[email protected]>
Cc Nitin Gupta <[email protected]>

---

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
diff -Napur -X linux-2.6.39-rc3/Documentation/dontdiff linux-2.6.39-rc3-cleancache/arch/x86/include/asm/xen/hypercall.h linux-2.6.39-rc3-cleancache-xen/arch/x86/include/asm/xen/hypercall.h
@@ -447,6 +447,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
diff -Napur -X linux-2.6.39-rc3/Documentation/dontdiff linux-2.6.39-rc3-cleancache/drivers/xen/Makefile linux-2.6.39-rc3-cleancache-xen/drivers/xen/Makefile
@@ -1,5 +1,6 @@
 obj-y	+= grant-table.o features.o events.o manage.o balloon.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
diff -Napur -X linux-2.6.39-rc3/Documentation/dontdiff linux-2.6.39-rc3-cleancache/include/xen/interface/xen.h linux-2.6.39-rc3-cleancache-xen/include/xen/interface/xen.h
@@ -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. */
#1 lore raw
Quoted 5 lines · Dan Magenheimer

[PATCH] xen: cleancache shim to Xen Transcendent Memory

This patch provides a shim between the kernel-internal cleancache API (see Documentation/mm/cleancache.txt) and the Xen Transcendent Memory ABI (see http://oss.oracle.com/projects/tmem).

There's no need to build this into a kernel which doesn't have cleancache (or one of the other frontends), is there? I think there should be a Kconfig option (even if its not a user visible one) with the appropriate depends/selects.

Ian.

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#2 lore raw
Quoted 7 lines

From: Ian Campbell [mailto:[email protected]]
Sent: Friday, April 15, 2011 4:02 PM
Subject: Re: [PATCH] xen: cleancache shim to Xen Transcendent Memory =20

Quoted 2 lines · Dan Magenheimer

[PATCH] xen: cleancache shim to Xen Transcendent Memory

Quoted 8 lines
Quoted 3 lines

This patch provides a shim between the kernel-internal cleancache API (see Documentation/mm/cleancache.txt) and the Xen Transcendent Memory ABI (see http://oss.oracle.com/projects/tmem).

=20
There's no need to build this into a kernel which doesn't have cleancache (or one of the other frontends), is there? I think there should be a Kconfig option (even if its not a user visible one) with the appropriate depends/selects.

Yes, you're right. It should eventually depend on

CONFIG_CLEANCACHE || CONFIG_FRONTSWAP

though there's no sense merging this xen cleancache shim at all unless/until Linus merges cleancache (and hopefully later some evolution of frontswap).

And once cleancache (and/or frontswap) is merged,
there's very little reason NOT to enable one or
both on a Xen guest kernel.

Thanks,
Dan

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#3 lore raw
Quoted 16 lines · Dan Magenheimer
Quoted 7 lines

From: Ian Campbell [mailto:[email protected]]
Sent: Friday, April 15, 2011 4:02 PM
Subject: Re: [PATCH] xen: cleancache shim to Xen Transcendent Memory

Quoted 2 lines · Dan Magenheimer

[PATCH] xen: cleancache shim to Xen Transcendent Memory

Quoted 8 lines
Quoted 3 lines

This patch provides a shim between the kernel-internal cleancache API (see Documentation/mm/cleancache.txt) and the Xen Transcendent Memory ABI (see http://oss.oracle.com/projects/tmem).

There's no need to build this into a kernel which doesn't have cleancache (or one of the other frontends), is there? I think there should be a Kconfig option (even if its not a user visible one) with the appropriate depends/selects.

Quoted 7 lines

Yes, you're right. It should eventually depend on

CONFIG_CLEANCACHE || CONFIG_FRONTSWAP

though there's no sense merging this xen cleancache shim at all unless/until Linus merges cleancache (and hopefully later some evolution of frontswap).

Cleancache isn't in already? I thought I saw references to it in drivers/staging?

Quoted 3 lines

And once cleancache (and/or frontswap) is merged, there's very little reason NOT to enable one or both on a Xen guest kernel.

There are software knobs to allow the host- and guest-admin to opt in or out as they desire though, right?

Ian.

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#4 lore raw
Quoted 12 lines

From: Ian Campbell [mailto:[email protected]]

Quoted 6 lines
Quoted 6 lines · Dan Magenheimer

There's no need to build this into a kernel which doesn't have cleancache (or one of the other frontends), is there? I think there should be a Kconfig option (even if its not a user visible one)

with

Quoted 4 lines
Quoted 1 line

the appropriate depends/selects.

Yes, you're right. It should eventually depend on

Quoted 8 lines
Quoted 5 lines

CONFIG_CLEANCACHE || CONFIG_FRONTSWAP

though there's no sense merging this xen cleancache shim at all unless/until Linus merges cleancache (and hopefully later some evolution of frontswap).

=20
Cleancache isn't in already? I thought I saw references to it in drivers/staging?

Linus said he would review it after 2.6.39-rc1 was released, but has neither given thumbs up nor thumbs down so I'm assuming he didn't have time and it will be reconsidered for 2.6.40. This latest patchset (V8) is updated in linux-next.

Yes, zcache is in driver/staging and has references to it. I guess that proves the chicken comes before the egg... or was it vice versa? :-)
=20

Quoted 6 lines
Quoted 3 lines

And once cleancache (and/or frontswap) is merged, there's very little reason NOT to enable one or both on a Xen guest kernel.

=20
There are software knobs to allow the host- and guest-admin to opt in or out as they desire though, right?

Definitely. Both Xen and a Linux guest have runtime options, which currently default to off.

Dan

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#5 lore raw
Quoted 21 lines · Dan Magenheimer
Quoted 12 lines

From: Ian Campbell [mailto:[email protected]]

Quoted 6 lines
Quoted 6 lines · Dan Magenheimer

There's no need to build this into a kernel which doesn't have cleancache (or one of the other frontends), is there? I think there should be a Kconfig option (even if its not a user visible one)

with

Quoted 4 lines
Quoted 1 line

the appropriate depends/selects.

Yes, you're right. It should eventually depend on

Quoted 8 lines
Quoted 5 lines

CONFIG_CLEANCACHE || CONFIG_FRONTSWAP

though there's no sense merging this xen cleancache shim at all unless/until Linus merges cleancache (and hopefully later some evolution of frontswap).

Cleancache isn't in already? I thought I saw references to it in drivers/staging?

Quoted 8 lines

Linus said he would review it after 2.6.39-rc1 was released, but has neither given thumbs up nor thumbs down so I'm assuming he didn't have time and it will be reconsidered for 2.6.40. This latest patchset (V8) is updated in linux-next.

Yes, zcache is in driver/staging and has references to it. I guess that proves the chicken comes before the egg... or was it vice versa? :-)

Ah, I didn't realise that the relaxations associated with staging allowed for unsatisfiable (due to the other half being out of tree) Kconfig items as well.

Quoted 9 lines
Quoted 6 lines
Quoted 3 lines

And once cleancache (and/or frontswap) is merged, there's very little reason NOT to enable one or both on a Xen guest kernel.

There are software knobs to allow the host- and guest-admin to opt in or out as they desire though, right?

Definitely. Both Xen and a Linux guest have runtime options, which currently default to off.

Good to know, thanks!

Ian.