Showing posts with label KVM. Show all posts
Showing posts with label KVM. Show all posts

Thursday, February 16, 2012

Using Kernel Samepage Merging with KVM

For the original and writeup of the article, do look at Using KSM (Kernel Samepage Merging) with KVM.

In short, from the article
Kernel SamePage Merging is a recent linux kernel feature which combines identical memory pages from multiple processes into one copy on write memory region. Because kvm guest virtual machines run as processes under linux, this feature provides the memory overcommit feature to kvm so important to hypervisors for more efficient use of memory......

Pointer 1. Verifying Kernel KSM Support
# grep KSM /boot/config -'uname -r'

You should see something like this if KSM is enabled
CONFIG_KSM=y

You should also see a directory for KSM in
Pix taken from Linux-KVM

Pointer 2: By default, KSM is limited to 2000 kernel pages.

To verify, type the following command
# cat /sys/kernel/mm/ksm/max_kernel_pages
You should see
2000

Pointer 3: Verifying KVM Support for Samepage Merging

From the article.....
In order for your KVM guests to take advantage of KSM, your version of qemu-kvm must explicitly request from the kernel that identical pages be merged using the new madvise interface. The patch for this feature was added to the kvm development tree just recently following the kvm-88 release. If you’re compiling kvm yourself you can verify whether your version of kvm will support KSM by inspecting exec.c source file for the following lines of code

If you don’t see these lines in your exec.c file then your kvm process will still run fine but but it won’t take advantage of KSM.
#ifdef MADV_MERGEABLE
        madvise(new_block->host, size, MADV_MERGEABLE);
#endif

Pointer 4 - Run multiple simiar guests
.......With multiple virtual machines running, you can verify that KSM is working by inspecting the following file to see how many pages are being shared between your kvm guests.

If the value is greateer than zero, KSM is used
# cat /sys/kernel/mm/KSM/pages_sharing

Saturday, April 23, 2011

Red Hat Summit 2010 Presentations slides

A good respository of latest technologies presentation slides that was presented at Boston 2010. See Red Hat Summit Presentations

Monday, December 13, 2010

ERROR unable to connect to '/var/run/libvirt/libvirt-sock': Connection refused

Please ensure all these steps are done first. We can then isolate the error more accurately. The 1st few steps are taken from HowtoForge Virtualization With KVM On A CentOS 5.2 Server



Step 1: Checking the Virtualisation Technology on AMD and Intel

Step 2: Install KVM and virtinst
# yum install  kvm kmod-kvm qemu libvirt python-virtinst
Step 3: Reboot the System
# shutdown -r now
Step 4: Check that the KVM kernel Module is loaded
# lsmod grep kvm

kvm_intel     50452      0
kvm           109264     1 kvm_intel
(If you use Intel VT CPU, you should see the above, if you are using AMD-V processor, you should see kvm_amd)

When installing KVM and its related components on CentOS 5.x , you might encounter the error when you type the command "# virt-install"
ERROR unable to connect to '/var/run/libvirt/libvirt-sock': Connection refused
Traceback (most recent call last):
   File "/usr/sbin/virt-install", line 889, in ?
      main()
   File "/usr/sbin/virt-install", line 628, in main
      conn = cli.getConnection(options.connect)
   File "/usr/lib/python2.4/site-packages/virtinst/cli.py", line 126, in getConnction
      conn = libvirt.open(connect)
   File "/usr/lib64/python2.4/site-packages/libvirt.py", line 159, in open
     if ret is None:raise libvirtError('virConnectOpen() failed')
libvirtError: unable to connect to '/var/run/libvirt/libvirt-sock': Connection refused
To solve this, edit /etc/libvirt/libvirtd.conf and
# vim /etc/libvirt/libvirtd.conf
uncommented out the listen_tls = 0 line
listen_tls = 0
Start the libvirtd Daemon
# service libvirtd start

You should able to eliminate the error