From: Izik Eidus <izik@qumranet.com>
To: Sukanto Ghosh <sukanto.cse.iitb@gmail.com>
Cc: kvm@vger.kernel.org
Subject: Re: KSM Algorithm
Date: Thu, 10 Jul 2008 05:44:30 -0500 [thread overview]
Message-ID: <4875E80E.3020305@qumranet.com> (raw)
In-Reply-To: <a85e78f50807100243m196f9d91v8d4fc14f83a32a10@mail.gmail.com>
ציטוט Sukanto Ghosh:
>>> Are every guest pages scanned in KVM while using KSM or page-scanning
>>> and sharing is triggered on some event (low memory, etc) ?
>>>
>>>
>> no, the scanning run all the time (with number pages to scan and sleep
>> parameters...)
>>
>
> Does the scanner(s) run as separate kernel threads ?\
>
it can run as kernel thread / or by ioctl runing from userspace
>
>
>>> Is sharing done only between the pages which have been registered via
>>> KSM_REGISTER_MEMORY_REGION ?
>>>
>>>
>> yes
>>
>>
>>> What are these for ? KSM_CREATE_SHARED_MEMORY_AREA and KSM_CREATE_SCAN ?
>>>
>>>
>> KSM_CREATE_SHARED_MEMORY_AREA - to register memory area to be scanned for
>> identical pages
>> KSM_CREATE_SCAN - to create the scanner that scan for this pages
>>
>
>
> So kvm will create a scanner using KSM_CREATE_SCAN ioctl to /dev/ksm.
> kvm sets its parameters which specify the frequency of scan operation.
> Then, it tries to determine periodically from the shadow page tables
> about the guest memory region, and registers them with the /dev/ksm.
> The scanner as configured will scan the registered areas and will
> create COW shared pages for identical pages.
> Am I right ?
>
yea
> Doesn't KSM notifies KVM about the shared pages so that KVM can update
> its sptes accordingly or is it done by KSM itself ?
>
when using kvm, mmu notifiers is a must for ksm, (mmu notifiers update
kvm about the changes in the host page table)
> What about KSM being used by someone other than KVM ? Does KSM updates
> the ptes of the shared pages itself ?
>
it can be used by any application, it update the ptes of the host, what
you mean by the shared pages itself?
>
>
>>> Where are the shared pages kept ? In kernel memory ? Aren't the shared
>>> pages always pinned in RAM (due to same reasons for pinned shadowed
>>> pages) ?
>>>
>>>
>> in the version that was sent to the list it was kernel memory (meaning
>> shared pages are not swappable
>> (just the pages that are shared not the pages that we scan, when they 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
>>
>>
>
> What is the strategy/method which you will use to represent the shared
> memory as normal anonymous/userspace memory ? Then, these pages must
> be staying at one of the guest's address-space (whose pages have been
>
> shared) ?
>
it possible due to another patch that i need to send, that allow modules
register new reverse mapping call backs...,
>
>
>>> How much is the overhead involved due to this ?
>>>
>>>
>> depeand on the speed you tell it to scan, but the overhead is about ~5% for
>> common cases
>>
>
> Can I know the typical values of the parameters : sleep time, no. of
> pages to scan, which you used to arrive at the above mentioned
> overhead.
>
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 pages
when a new shared page is created, i have possible way to change it and
reduce the cpu even more
but i dont know if i want to do it) (it add more IFs to the fast path
inside the mm)
>
>
next prev parent reply other threads:[~2008-07-10 10:44 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-10 8:32 KSM Algorithm Sukanto Ghosh
2008-07-10 9:21 ` Izik Eidus
2008-07-10 9:43 ` Sukanto Ghosh
2008-07-10 10:44 ` Izik Eidus [this message]
2008-07-10 11:18 ` Sukanto Ghosh
2008-07-10 19:20 ` Izik Eidus
2008-07-10 11:23 ` Sukanto Ghosh
2008-07-10 13:39 ` Sukanto Ghosh
2008-07-10 13:40 ` Izik Eidus
2008-07-19 6:51 ` Sukanto Ghosh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4875E80E.3020305@qumranet.com \
--to=izik@qumranet.com \
--cc=kvm@vger.kernel.org \
--cc=sukanto.cse.iitb@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox