From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Tokarev Subject: Re: KSM with Debian GNU/Linux Date: Mon, 09 Aug 2010 19:28:23 +0400 Message-ID: <4C601E97.3080102@msgid.tls.msk.ru> References: <20100809101635.GB1771@defiant.freesoftware> <4C5FD800.9000905@msgid.tls.msk.ru> <20100809142732.GC1771@defiant.freesoftware> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit To: dbareiro@gmx.net, KVM General Return-path: Received: from isrv.corpit.ru ([86.62.121.231]:56335 "EHLO isrv.corpit.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756697Ab0HIP21 (ORCPT ); Mon, 9 Aug 2010 11:28:27 -0400 In-Reply-To: <20100809142732.GC1771@defiant.freesoftware> Sender: kvm-owner@vger.kernel.org List-ID: 09.08.2010 18:27, Daniel Bareiro wrote: > On Monday, 09 August 2010 14:27:12 +0400, > Michael Tokarev wrote: > >>> I have understood that in addition to support from the kernel and >>> qemu-kvm, there must be support in libc. So in testing I was doing on >>> Lenny, it did not work using libc from Debian repositories. Now that >>> squeeze is frozen, anyone knows if it will support KSM? > >> KSM is working in qemu-kvm packages in bpo, for quite long >> time already. It has nothing to do with libc, and now it >> does not even require recent-enough kernel headers to compile. >> What's needed is recent-enough kernel that actually implements >> the feature. The kernel in Lenny does not KSM support, but >> the one in bpo has. Also note that Lenny's kernel is too old >> for kvm. > > I'm using Linux 2.6.32.3 compiled by myself with the kernel.org source > code with support for KSM: > > # cat /boot/config-2.6.32.3-dgb | grep KSM > CONFIG_KSM=y > > I'm also using qemu-kvm 0.12.1.2 compiled by myself with the source code > of SourceForge. Note that this one has numerous bugs, some of which involves data corruption. JFYI. > These are the checks that I was doing in the VMHost: > > # ll /sys/kernel/mm/ksm/ > total 0 > -r--r--r-- 1 root root 4096 ago 9 06:28 full_scans > -rw-r--r-- 1 root root 4096 ago 9 06:28 max_kernel_pages > -r--r--r-- 1 root root 4096 ago 9 06:28 pages_shared > -r--r--r-- 1 root root 4096 ago 9 06:28 pages_sharing > -rw-r--r-- 1 root root 4096 ago 9 06:28 pages_to_scan > -r--r--r-- 1 root root 4096 ago 9 06:28 pages_unshared > -r--r--r-- 1 root root 4096 ago 9 06:28 pages_volatile > -rw-r--r-- 1 root root 4096 ago 9 06:27 run > -rw-r--r-- 1 root root 4096 ago 9 06:28 sleep_millisecs > > > # cat /sys/kernel/mm/ksm/max_kernel_pages > 253500 > > But KSM seems not work: > > # cat /sys/kernel/mm/ksm/pages_sharing > 0 Did you actually enable it in the kernel? Did you read the ksm docs shipped with the kernel? > Should I have some additional consideration when compiling qemu-kvm? Please note what Nikola Ciprich said. If you don't have kernel headers that defines MADV_MERGEABLE, you'll have to define it when compiling kvm. Note again that debian qemu-kvm package (you're asking about debian after all) includes support for KSM. It also includes a small patch to #define that symbol. /mjt