[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090402193920.GF10392@x200.localdomain>
Date: Thu, 2 Apr 2009 12:39:20 -0700
From: Chris Wright <chrisw@...hat.com>
To: Jesper Juhl <jj@...osbits.net>
Cc: Izik Eidus <ieidus@...hat.com>, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org, linux-mm@...ck.org, avi@...hat.com,
aarcange@...hat.com, chrisw@...hat.com, riel@...hat.com,
jeremy@...p.org, mtosatti@...hat.com, hugh@...itas.com,
corbet@....net, yaniv@...hat.com, dmonakhov@...nvz.org
Subject: Re: [PATCH 0/4] ksm - dynamic page sharing driver for linux
* Jesper Juhl (jj@...osbits.net) wrote:
> Do you rely only on the checksum or do you actually compare pages to check
> they are 100% identical before sharing?
Checksum has absolutely nothing to do w/ finding if two pages match.
It's only used as a heuristic to suggest whether a single page has
changed. If that page is changing we won't bother trying to find a
match for it. Here's an example of the life of a page w.r.t checksum.
1. checksum = uninitialized
2. first time page is found, checksum it (checksum = A).
if checksum has changed (uninitialize != A) don't go any further w/ that page
3. next time page is found, checksum it (checksum = B).
if checksum has change (A != B) don't go any further w/ that page
4. next time page is found, checksum it (checksum = B).
if checksum has changed (B == B)...it hasn't, continue processing the
page
later if a match is found in the tree (which is sorted by _contents_,
i.e. memcmp) we'll attempt to merge the pages which at it's very core
does:
if (pages_identical(oldpage, newpage))
ret = replace_page(vma, oldpage, newpage, orig_pte, newprot);
pages_identical? you guessed it...just does:
r = memcmp(addr1, addr2, PAGE_SIZE)
thanks,
-chris
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists