linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Prateek Sharma <prateek3.14@gmail.com>
To: linux-mm@kvack.org
Subject: KSM Unstable tree questiom
Date: Thu, 25 Aug 2011 19:11:28 +0530	[thread overview]
Message-ID: <CAKwxwqxxPRkTtHy4GvK8JFGV04FpJ5M39gTSwPDQAHxY=qJn8Q@mail.gmail.com> (raw)

Hello everyone .
I've been trying to understand how KSM works (i want to make some
modifications / implement some optimizations) .
One thing that struck me odd was the high number of calls to
remove_rmap_item_from_tree .
Particularly, this instance in cmp_and_merge_page :

               /*
                * As soon as we merge this page, we want to remove the
                * rmap_item of the page we have merged with from the unstable
                * tree, and insert it instead as new node in the stable tree.
                */
               if (kpage) {
                       remove_rmap_item_from_tree(
tree_rmap_item);

                       lock_page(kpage);
                       stable_node = stable_tree_insert(kpage);
                       if (stable_node) {
                               stable_tree_append(tree_rmap_item, stable_node);
                               stable_tree_append(rmap_item, stable_node);
                       }

Here, from i understand, we've found a match in the unstable tree, and
are adding a stable node in the stable tree.
My question is: why do we need to remove the rmap_item from unstable
tree here? At the end of a scan we are erasing the unstable tree
anyway. Also, all searches first consider the stable tree , and then
the unstable tree.
What will happen if we find a match in the unstable tree, and simply
update tree_rmap_item to point to a stable_node ?

Thanks for reading. I'd love to share the ideas i have for (attempting
to) improve KSM, if anyone is interested.

Prateek

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

                 reply	other threads:[~2011-08-25 13:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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='CAKwxwqxxPRkTtHy4GvK8JFGV04FpJ5M39gTSwPDQAHxY=qJn8Q@mail.gmail.com' \
    --to=prateek3.14@gmail.com \
    --cc=linux-mm@kvack.org \
    /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