linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Hugh Dickins <hughd@google.com>
To: CAI Qian <caiqian@redhat.com>
Cc: linux-mm <linux-mm@kvack.org>
Subject: Re: understand KSM
Date: Tue, 26 Oct 2010 21:00:42 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LSU.2.00.1010262050140.6304@sister.anvils> (raw)
In-Reply-To: <862326461.384731288091669063.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com>

On Tue, 26 Oct 2010, CAI Qian wrote:
> 
> > > There are 3 programs (A, B ,C) to allocate 128M memory each using
> > KSM.
> > > 
> > > A has memory content equal 'c'.
> > > B has memory content equal 'a'.
> > > C has memory content equal 'a'.
> > > 
> > > Then (using the latest mmotm tree),
> > > pages_shared = 2
> > > pages_sharing = 98292
> > > pages_unshared = 0
> > 
> > So, after KSM has done its best, it all reduces to 1 page full of
> > 'a's and another 1 page full of 'c's.
> I would expect pages_sharing to be 98302 (128 * 256 - 2), but this one looks unstable. Increased pages_to_scan to 2 * 98304 did not help either.

Since your 1MB malloc'ed buffers may not fall on page boundaries,
and there might occasionally be other malloc'ed areas interspersed
amongst them, I'm not surprised that pages_sharing falls a little
short of 98302.  But I am surprised that pages_unshared does not
make up the difference; probably pages_volatile does, but I don't
see why some should remain volatile indefinitely.

> 
> Thanks for the other suggestions! After modified the test accordingly, it looks like work as expected.

Oh good, that's a relief.

Hugh

--
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:[~2010-10-27  4:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <356409918.247361287997619777.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com>
2010-10-25  9:11 ` caiqian
2010-10-26  8:03   ` Hugh Dickins
2010-10-26 11:14     ` CAI Qian
2010-10-27  4:00       ` Hugh Dickins [this message]
     [not found] <395413139.534301288167215758.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com>
2010-10-27  8:16 ` caiqian
2010-11-09  6:48   ` Hugh Dickins
2010-11-10  9:25     ` CAI Qian

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=alpine.LSU.2.00.1010262050140.6304@sister.anvils \
    --to=hughd@google.com \
    --cc=caiqian@redhat.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