From mboxrd@z Thu Jan 1 00:00:00 1970 From: Izik Eidus Subject: Re: KSM Algorithm Date: Thu, 10 Jul 2008 14:20:08 -0500 Message-ID: <487660E8.504@qumranet.com> References: <4875D47E.603@qumranet.com> <4875E80E.3020305@qumranet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: kvm@vger.kernel.org To: Sukanto Ghosh Return-path: Received: from mis011-2.exch011.intermedia.net ([64.78.21.129]:5001 "EHLO mis011-2.exch011.intermedia.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753351AbYGJLUc (ORCPT ); Thu, 10 Jul 2008 07:20:32 -0400 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: =D7=A6=D7=99=D7=98=D7=95=D7=98 Sukanto Ghosh: >>> Doesn't KSM notifies KVM about the shared pages so that KVM can upd= ate >>> its sptes accordingly or is it done by KSM itself ? >>> >>> =20 >> when using kvm, mmu notifiers is a must for ksm, (mmu notifiers upda= te kvm >> about the changes in the host page table) >> >> =20 >>> What about KSM being used by someone other than KVM ? Does KSM upda= tes >>> the ptes of the shared pages itself ? >>> >>> =20 >> it can be used by any application, it update the ptes of the host, w= hat you >> mean by the shared pages itself? >> =20 > > by "itself" I meant 'ksm'. So ksm will take care of updating the ptes > of the shared guest pages. > =20 yes > > =20 >>> =20 >>>>> Where are the shared pages kept ? In kernel memory ? Aren't the s= hared >>>>> pages always pinned in RAM (due to same reasons for pinned shadow= ed >>>>> pages) ? >>>>> >>>>> >>>>> =20 >>>> in the version that was sent to the list it was kernel memory (mea= ning >>>> shared pages are not swappable >>>> (just the pages that are shared not the pages that we scan, when t= hey are >>>> split beacuse of copy on write it become swappable again >>>> new version that i will send soon the pages are normal >>>> anonymous/userspace >>>> memory that is swappable >>>> >>>> >>>> =20 >>> What is the strategy/method which you will use to represent the sha= red >>> memory as normal anonymous/userspace memory ? Then, these pages mus= t >>> be staying at one of the guest's address-space (whose pages have be= en >>> shared) ? >>> >>> =20 >> it possible due to another patch that i need to send, that allow mod= ules >> register new reverse mapping call backs..., >> >> =20 > ok > > but in whose address-space will these shared pages stay ? > > =20 if we have 5 applications sharing the same page, we will have the page=20 stay in 5 diffrent address-spaces... > =20 >>> =20 >>>>> How much is the overhead involved due to this ? >>>>> >>>>> >>>>> =20 >>>> depeand on the speed you tell it to scan, but the overhead is abou= t ~5% >>>> for >>>> common cases >>>> >>>> =20 >>> Can I know the typical values of the parameters : sleep time, no. o= f >>> pages to scan, which you used to arrive at the above mentioned >>> overhead. >>> >>> =20 >> i think it is about 256 2000 (256 pages per 2000 usleep) >> (note that most of the cpu is acutlay taken by the copying of the pa= ges when >> a new shared page is created, i have possible way to change it and r= educe >> the cpu even more >> but i dont know if i want to do it) (it add more IFs to the fast pat= h inside >> the mm) >> >> >> =20 >>> =20 >> =20 > > Thanks :) > > =20