Skip to contentSkip to conversation

Copy-on write sharing

DISCUSSION zhangzhi 2 participants 3 messages May 31, 2012 – Jun 1, 2012 1 message not in the archive

lore
Share & tools
lore

zhangzhi

author
#0 lore raw

Hi, list,

xen 4.0 release has said that it had a special feature of copy-on write sharing of identical memory pages between VMs (HVM only).
I just wanna know the source code that illustrate this feature. Is anyone have an idea about the this feature as well as its specific source code? thanks.

--
View this message in context: http://xen.1045712.n5.nabble.com/Copy-on-write-sharing-tp5709207.html
Sent from the Xen - Dev mailing list archive at Nabble.com.

#1 lore raw

Hi,

Quoted 3 lines · zhangzhi

xen 4.0 release has said that it had a special feature of copy-on write sharing of identical memory pages between VMs (HVM only).
I just wanna know the source code that illustrate this feature.

The code inside the hypervisor lives in xen/arch/x86/mm/, mostly in the file mem_sharing.c.

The user-space interface is in libxc, in tools/libxc/xc_memshr.c

An example program that uses it is tools/tests/mem-sharing/memshrtool.c.

This feature is not built in to the higher-level tools (libxl &c) at the moment; originally there were extensions to blktap that could automatically share pages that were read from disk if the VMs' disks came from the same source image, but I think that's all bitrotted. If anyone wanted to try to get that working again, I'm sure it would be welcome!

Cheers,

Tim.

#3 lore raw
In reply to a message not in the archive

Hi,

Please don't drop the list from Cc. I have put it back.

Quoted 3 lines · ????

Hi, I just read about the source code (mainly the mem_sharing.c) that you mentioned before, but it seemed not like what I was looking for, and it doesn't make use of the rbtree for page sharing.

mem_sharing.c is just the mechanism for having two VMs share a page. The choices of which pages to share are left to the tools. As I said the in-tree Xen tools don't currently have a good way to select pages to share (though there are some out-of-tree users).

Quoted 3 lines

I felt that the functionality of this mem_sharing.c file is not like the KSM(kernel samepage mechanism), which operates in the KVM(kernel virtual machine).

That's right. KVM reuses linux's existing in-kernel mechanism for finding and sharing suitable pages.

Tim.