linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Izik Eidus <ieidus@redhat.com>
To: Jesper Juhl <jj@chaosbits.net>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	linux-mm@kvack.org, avi@redhat.com, aarcange@redhat.com,
	chrisw@redhat.com, riel@redhat.com, jeremy@goop.org,
	mtosatti@redhat.com, hugh@veritas.com, corbet@lwn.net,
	yaniv@redhat.com, dmonakhov@openvz.org
Subject: Re: [PATCH 0/4] ksm - dynamic page sharing driver for linux
Date: Thu, 02 Apr 2009 22:38:07 +0300	[thread overview]
Message-ID: <49D5141F.40900@redhat.com> (raw)
In-Reply-To: <alpine.LNX.2.00.0904022114040.4265@swampdragon.chaosbits.net>

Jesper Juhl wrote:
> Hi,
>
> On Tue, 31 Mar 2009, Izik Eidus wrote:
>
>   
>> KSM is a linux driver that allows dynamicly sharing identical memory
>> pages between one or more processes.
>>
>> Unlike tradtional page sharing that is made at the allocation of the
>> memory, ksm do it dynamicly after the memory was created.
>> Memory is periodically scanned; identical pages are identified and
>> merged.
>> The sharing is unnoticeable by the process that use this memory.
>> (the shared pages are marked as readonly, and in case of write
>> do_wp_page() take care to create new copy of the page)
>>
>> To find identical pages ksm use algorithm that is split into three
>> primery levels:
>>
>> 1) Ksm will start scan the memory and will calculate checksum for each
>>    page that is registred to be scanned.
>>    (In the first round of the scanning, ksm would only calculate
>>     this checksum for all the pages)
>>
>>     
>
> One question;
>
> Calcolating a checksum is a fine way to find pages that are "likely to be 
> identical"

I dont use checksum as with hash table, the checksum doesnt use to find 
identical pages by the way that they have similer data...
the checksum is used to let me know that the page was not changed for a 
while and it is worth checking for identical pages to it...
In the future we will want to use the page table dirty bit for it, as 
taking checksum is somewhat expensive

> , but there is no guarantee that two pages with the same 
> checksum really are identical - there *will* be checksum collisions 
> eventually. So, I really hope that your implementation actually checks 
> that two pages that it find that have identical checksums really are 100% 
> identical by comparing them bit by bit before throwing one away.
>   
We do that :-)

> If you rely only on a checksum then eventually a user will get bitten by a 
> checksum collision and, in the best case, something will crash, and in the 
> worst case, data will silently be corrupted.
>
> Do you rely only on the checksum or do you actually compare pages to check 
> they are 100% identical before sharing?
>   

I do 100% compare to the pages before i share them.

> I must admit that I have not read through the patch to find the answer, I 
> just read your description and became concerned.
>
>   
Dont worry, me neither :-)

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2009-04-02 19:42 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-30 23:59 Izik Eidus
2009-03-30 23:59 ` [PATCH 1/4] MMU_NOTIFIERS: add set_pte_at_notify() Izik Eidus
2009-03-30 23:59   ` [PATCH 2/4] add page_wrprotect(): write protecting page Izik Eidus
2009-03-30 23:59     ` [PATCH 3/4] add replace_page(): change the page pte is pointing to Izik Eidus
2009-03-30 23:59       ` [PATCH 4/4] add ksm kernel shared memory driver Izik Eidus
2009-03-31  2:12         ` Anthony Liguori
2009-03-31 12:24           ` Izik Eidus
2009-03-31 13:31             ` Anthony Liguori
2009-03-31 14:25               ` Andrea Arcangeli
2009-03-31 14:37                 ` Anthony Liguori
2009-03-31 15:02                   ` Andrea Arcangeli
2009-03-31 15:09                     ` Anthony Liguori
2009-03-31 15:18                       ` Andrea Arcangeli
2009-03-31 15:54                         ` Anthony Liguori
2009-03-31 16:25                           ` Andrea Arcangeli
2009-03-31 16:51                             ` Anthony Liguori
2009-03-31 17:11                               ` Andrea Arcangeli
2009-04-01 22:54                               ` Izik Eidus
2009-04-02  0:31                                 ` Anthony Liguori
2009-04-02  0:48                                   ` Chris Wright
2009-04-02  1:22                               ` Chris Wright
2009-04-02  2:36                                 ` Anthony Liguori
2009-04-02  5:31                                   ` [PATCH 5/4] update ksm userspace interfaces Chris Wright
2009-04-02 13:32                                     ` Izik Eidus
2009-04-02 15:20                                       ` Chris Wright
2009-04-02 15:56                                       ` Chris Wright
2009-04-02 15:55                                         ` Izik Eidus
2009-04-03 10:16                                       ` Gerd Hoffmann
2009-04-03 10:49                                         ` Izik Eidus
2009-04-03 11:08                                           ` Gerd Hoffmann
2009-04-03 16:22                                             ` Chris Wright
2009-04-02 14:41                                     ` Andrea Arcangeli
2009-04-02 15:12                                       ` Chris Wright
2009-04-02 15:25                                         ` Andrea Arcangeli
2009-04-02  5:48                                   ` [PATCH 4/4 alternative userspace] add ksm kernel shared memory driver Chris Wright
2009-04-02  5:57                                     ` Bert Wesarg
2009-04-02  5:59                                       ` Chris Wright
2009-04-02  6:00                                         ` Bert Wesarg
2009-04-02  7:09                                         ` Avi Kivity
2009-04-02  7:24                                   ` [PATCH 4/4] " Avi Kivity
2009-04-02  9:38                                   ` Andrea Arcangeli
2009-04-02 11:23                                   ` Izik Eidus
2009-03-31  2:15         ` KAMEZAWA Hiroyuki
2009-03-31 12:21           ` Izik Eidus
2009-03-31 23:57             ` KAMEZAWA Hiroyuki
2009-04-01 17:28               ` Izik Eidus
2009-03-31 20:52         ` Andrea Arcangeli
2009-03-31  1:42 ` [PATCH 0/4] ksm - dynamic page sharing driver for linux Anthony Liguori
2009-03-31 12:33   ` Izik Eidus
2009-04-02 19:22 ` Jesper Juhl
2009-04-02 19:38   ` Izik Eidus [this message]
2009-04-02 19:39   ` Chris Wright
2009-04-02 19:49     ` Jesper Juhl
  -- strict thread matches above, loose matches on Subject: below --
2008-11-11 13:21 Izik Eidus
2008-11-11 18:30 ` Andrew Morton
2008-11-11 18:48   ` Avi Kivity
2008-11-11 19:08     ` Izik Eidus
2008-11-11 19:11     ` Andrew Morton
2008-11-11 19:18       ` Izik Eidus
2008-11-11 19:32         ` Andrew Morton
2008-11-11 19:52           ` Izik Eidus
2008-11-11 20:08             ` Izik Eidus
2008-11-11 19:29       ` Avi Kivity
2008-11-11 19:55       ` Andrea Arcangeli
2008-11-11 19:07   ` Izik Eidus
2008-11-11 19:20     ` Andrew Morton

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=49D5141F.40900@redhat.com \
    --to=ieidus@redhat.com \
    --cc=aarcange@redhat.com \
    --cc=avi@redhat.com \
    --cc=chrisw@redhat.com \
    --cc=corbet@lwn.net \
    --cc=dmonakhov@openvz.org \
    --cc=hugh@veritas.com \
    --cc=jeremy@goop.org \
    --cc=jj@chaosbits.net \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mtosatti@redhat.com \
    --cc=riel@redhat.com \
    --cc=yaniv@redhat.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