Re: [PATCH 0/4] ksm - dynamic page sharing driver for linux

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Izik Eidus
Date: Tuesday, November 11, 2008 - 12:52 pm

Andrew Morton wrote:
Andrea i think what is happening here is my fault
i will try to give here much more information about KSM:
first the bad things:
KSM shared pages are right now (we have patch that can change it but we 
want to wait with it) unswappable
this mean that the entire memory of the guest is swappable but the pages 
that are shared are not.
(when the pages are splited back by COW they become anonymous again with 
the help of do_wp_page()
the reason that the pages are not swappable is beacuse the way the Linux 
Rmap is working, this not allow us to create nonlinear anonymous pages
(we dont want to use nonlinear vma for kvm, as it will make swapping for 
kvm very slow)
the reason that ksm pages need to have nonlinear reverse mapping is that 
for one guest identical page can be found in whole diffrent offset than 
other guest have it
(this is from the userspace VM point of view)

the rest is quite simple:
it is walking over the entire guest memory (or only some of it) and scan 
for identical pages using hash table
it merge the pages into one single write protected page

numbers for ksm is something that i have just for desktops and just the 
numbers i gave you
what is do know is:
big overcommit like 300% is possible just when you take into account 
that some of the guest memory will be free
we are sharing mostly the DLLs/ KERNEL / ZERO pages, for the DLLS and 
KERNEL PAGEs this pages likely will never break
but ZERO pages will be break when windows will allocate them and will 
come back when windows will free the memory.
(i wouldnt suggest 300% overcommit for servers workload, beacuse you can 
end up swapping in that case,
but for desktops after runing in production and passed some seiroes qa 
tress tests it seems like 300% is a real number that can be use)

i just ran test on two fedora 8 guests and got that results (using GNOME 
in both of them)
 9959 root      15   0  730m 537m 281m S    8  3.4   0:44.28 
kvm                                                                            

 9956 root      15   0  730m 537m 246m S    4  3.4   0:41.43 kvm
as you can see the physical sharing was 281mb and 246mb (kernel pages 
are counted as shared)
there is small lie in this numbers beacuse pages that was shared across 
two guests and was splited by writing from guest number 1 will still 
have 1 refernce count to it
and will still be kernel page (untill the other guest (num 2) will write 
to it as well)


anyway i am willing to make much better testing or everything that 
needed for this patchs to be merged.
(just tell me what and i will do it)

beside that you should know that patch 4 is not a must, it is just nice 
optimization...

thanks.

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 1/4] rmap: add page_wrprotect() function,, Izik Eidus, (Tue Nov 11, 6:21 am)
[PATCH 3/4] add ksm kernel shared memory driver, Izik Eidus, (Tue Nov 11, 6:21 am)
[PATCH 4/4] MMU_NOTIFIRES: add set_pte_at_notify(), Izik Eidus, (Tue Nov 11, 6:21 am)
Re: [PATCH 1/4] rmap: add page_wrprotect() function,, Andrew Morton, (Tue Nov 11, 12:39 pm)
Re: [PATCH 0/4] ksm - dynamic page sharing driver for linux, Izik Eidus, (Tue Nov 11, 12:52 pm)
Re: [PATCH 0/4] ksm - dynamic page sharing driver for linux, Andrea Arcangeli, (Tue Nov 11, 12:55 pm)
Re: [PATCH 1/4] rmap: add page_wrprotect() function,, Andrea Arcangeli, (Tue Nov 11, 1:38 pm)
Re: [PATCH 3/4] add ksm kernel shared memory driver, Andrew Morton, (Tue Nov 11, 1:38 pm)
Re: [PATCH 1/4] rmap: add page_wrprotect() function,, Andrew Morton, (Tue Nov 11, 2:01 pm)
Re: [PATCH 2/4] Add replace_page(), change the mapping of ..., Andrea Arcangeli, (Tue Nov 11, 2:06 pm)
Re: [PATCH 1/4] rmap: add page_wrprotect() function,, Andrea Arcangeli, (Tue Nov 11, 2:17 pm)
Re: [PATCH 2/4] Add replace_page(), change the mapping of ..., Christoph Lameter, (Tue Nov 11, 2:21 pm)
Re: [PATCH 2/4] Add replace_page(), change the mapping of ..., Christoph Lameter, (Tue Nov 11, 2:26 pm)
Re: [PATCH 2/4] Add replace_page(), change the mapping of ..., Christoph Lameter, (Tue Nov 11, 2:31 pm)
Re: [PATCH 2/4] Add replace_page(), change the mapping of ..., Andrea Arcangeli, (Tue Nov 11, 2:35 pm)
Re: [PATCH 2/4] Add replace_page(), change the mapping of ..., Christoph Lameter, (Tue Nov 11, 2:47 pm)
Re: [PATCH 3/4] add ksm kernel shared memory driver, Andrea Arcangeli, (Tue Nov 11, 3:03 pm)
Re: [PATCH 3/4] add ksm kernel shared memory driver, Jonathan Corbet, (Tue Nov 11, 3:03 pm)
Re: [PATCH 3/4] add ksm kernel shared memory driver, Izik Eidus, (Tue Nov 11, 3:17 pm)
Re: [PATCH 2/4] Add replace_page(), change the mapping of ..., Andrea Arcangeli, (Tue Nov 11, 3:17 pm)
Re: [PATCH 2/4] Add replace_page(), change the mapping of ..., Andrea Arcangeli, (Tue Nov 11, 3:24 pm)
Re: [PATCH 3/4] add ksm kernel shared memory driver, Jonathan Corbet, (Tue Nov 11, 3:25 pm)
Re: [PATCH 2/4] Add replace_page(), change the mapping of ..., Christoph Lameter, (Tue Nov 11, 3:30 pm)
Re: [PATCH 3/4] add ksm kernel shared memory driver, Jonathan Corbet, (Tue Nov 11, 3:30 pm)
Re: [PATCH 3/4] add ksm kernel shared memory driver, Izik Eidus, (Tue Nov 11, 3:31 pm)
Re: [PATCH 3/4] add ksm kernel shared memory driver, Izik Eidus, (Tue Nov 11, 3:38 pm)
Re: [PATCH 3/4] add ksm kernel shared memory driver, Valdis.Kletnieks, (Tue Nov 11, 3:40 pm)
Re: [PATCH 3/4] add ksm kernel shared memory driver, Avi Kivity, (Tue Nov 11, 3:43 pm)
Re: [PATCH 3/4] add ksm kernel shared memory driver, Avi Kivity, (Tue Nov 11, 3:49 pm)
Re: [PATCH 3/4] add ksm kernel shared memory driver, Izik Eidus, (Tue Nov 11, 4:02 pm)
Re: [PATCH 3/4] add ksm kernel shared memory driver, Andrea Arcangeli, (Tue Nov 11, 4:03 pm)
Re: [PATCH 2/4] Add replace_page(), change the mapping of ..., Andrea Arcangeli, (Tue Nov 11, 4:17 pm)
Re: [PATCH 2/4] Add replace_page(), change the mapping of ..., Andrea Arcangeli, (Tue Nov 11, 4:25 pm)
Re: [PATCH 2/4] Add replace_page(), change the mapping of ..., Christoph Lameter, (Tue Nov 11, 5:27 pm)
Re: [PATCH 2/4] Add replace_page(), change the mapping of ..., KAMEZAWA Hiroyuki, (Tue Nov 11, 7:19 pm)
Re: [PATCH 2/4] Add replace_page(), change the mapping of ..., Andrea Arcangeli, (Tue Nov 11, 7:27 pm)
Re: [PATCH 2/4] Add replace_page(), change the mapping of ..., Christoph Lameter, (Tue Nov 11, 8:10 pm)
Re: [PATCH 2/4] Add replace_page(), change the mapping of ..., Andrea Arcangeli, (Wed Nov 12, 10:32 am)
Re: [PATCH 2/4] Add replace_page(), change the mapping of ..., Lee Schermerhorn, (Wed Nov 12, 1:08 pm)
Re: [PATCH 2/4] Add replace_page(), change the mapping of ..., Christoph Lameter, (Wed Nov 12, 1:27 pm)
Re: [PATCH 2/4] Add replace_page(), change the mapping of ..., Christoph Lameter, (Wed Nov 12, 1:31 pm)
Re: [PATCH 2/4] Add replace_page(), change the mapping of ..., Lee Schermerhorn, (Wed Nov 12, 3:09 pm)
Re: [PATCH 2/4] Add replace_page(), change the mapping of ..., Andrea Arcangeli, (Wed Nov 12, 7:00 pm)
Re: [PATCH 2/4] Add replace_page(), change the mapping of ..., Andrea Arcangeli, (Wed Nov 12, 7:31 pm)
Re: [PATCH 2/4] Add replace_page(), change the mapping of ..., KAMEZAWA Hiroyuki, (Wed Nov 12, 11:11 pm)
Re: [PATCH 3/4] add ksm kernel shared memory driver, Eric Rannaud, (Wed Nov 12, 11:13 pm)
Re: [PATCH 2/4] Add replace_page(), change the mapping of ..., KAMEZAWA Hiroyuki, (Thu Nov 13, 4:32 am)