All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Jeons <simon.jeons@gmail.com>
To: Hugh Dickins <hughd@google.com>
Cc: Petr Holasek <pholasek@redhat.com>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Izik Eidus <izik.eidus@ravellosystems.com>,
	Rik van Riel <riel@redhat.com>,
	David Rientjes <rientjes@google.com>,
	Sasha Levin <sasha.levin@oracle.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Anton Arapov <anton@redhat.com>
Subject: Re: [PATCH v7 1/2] KSM: numa awareness sysfs knob
Date: Thu, 03 Jan 2013 18:24:04 -0600	[thread overview]
Message-ID: <1357259044.4930.4.camel@kernel.cn.ibm.com> (raw)
In-Reply-To: <alpine.LNX.2.00.1301022050450.979@eggly.anvils>

On Wed, 2013-01-02 at 21:10 -0800, Hugh Dickins wrote:
> On Tue, 1 Jan 2013, Simon Jeons wrote:
> > 
> > Hi Petr and Hugh,
> > 
> > One offline question, thanks for your clarify.
> 
> Perhaps not as offline as you intended :)

Hi Hugh,

Thanks for your detail explanation. :)

> 
> > 
> > How to understand age = (unsigned char)(ksm_scan.seqnr -
> > rmap_item->address);? It used for what?
> 
> As you can see, remove_rmap_item_from_tree uses it to decide whether
> or not it should rb_erase the rmap_item from the unstable_tree.
> 
> Every full scan of all the rmap_items, we increment ksm_scan.seqnr,
> forget the old unstable_tree (it would just be a waste of processing
> to remove every node one by one), and build up the unstable_tree afresh.
> 

When the rmap_items left over from the previous scan will be removed?

> That works fine until we need to remove an rmap_item: then we have to be
> very sure to remove it from the unstable_tree if it's already been linked
> there during this scan, but ignore its rblinkage if that's just left over
> from the previous scan.
> 
> A single bit would be enough to decide this; but we got it troublesomely
> wrong in the early days of KSM (didn't always visit every rmap_item each
> scan), so it's convenient to use 8 bits (the low unsigned char, stored

When the scenario didn't always visit every rmap_item each scan can
occur? 

> below the FLAGs and below the page-aligned address in the rmap_item -
> there's lots of them, best keep them as small as we can) and do a
> BUG_ON(age > 1) if we made a mistake.
> 
> We haven't hit that BUG_ON in over three years: if we need some more
> bits for something, we can cut the age down to one or two bits.
> 
> 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>

WARNING: multiple messages have this Message-ID (diff)
From: Simon Jeons <simon.jeons@gmail.com>
To: Hugh Dickins <hughd@google.com>
Cc: Petr Holasek <pholasek@redhat.com>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Izik Eidus <izik.eidus@ravellosystems.com>,
	Rik van Riel <riel@redhat.com>,
	David Rientjes <rientjes@google.com>,
	Sasha Levin <sasha.levin@oracle.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Anton Arapov <anton@redhat.com>
Subject: Re: [PATCH v7 1/2] KSM: numa awareness sysfs knob
Date: Thu, 03 Jan 2013 18:24:04 -0600	[thread overview]
Message-ID: <1357259044.4930.4.camel@kernel.cn.ibm.com> (raw)
In-Reply-To: <alpine.LNX.2.00.1301022050450.979@eggly.anvils>

On Wed, 2013-01-02 at 21:10 -0800, Hugh Dickins wrote:
> On Tue, 1 Jan 2013, Simon Jeons wrote:
> > 
> > Hi Petr and Hugh,
> > 
> > One offline question, thanks for your clarify.
> 
> Perhaps not as offline as you intended :)

Hi Hugh,

Thanks for your detail explanation. :)

> 
> > 
> > How to understand age = (unsigned char)(ksm_scan.seqnr -
> > rmap_item->address);? It used for what?
> 
> As you can see, remove_rmap_item_from_tree uses it to decide whether
> or not it should rb_erase the rmap_item from the unstable_tree.
> 
> Every full scan of all the rmap_items, we increment ksm_scan.seqnr,
> forget the old unstable_tree (it would just be a waste of processing
> to remove every node one by one), and build up the unstable_tree afresh.
> 

When the rmap_items left over from the previous scan will be removed?

> That works fine until we need to remove an rmap_item: then we have to be
> very sure to remove it from the unstable_tree if it's already been linked
> there during this scan, but ignore its rblinkage if that's just left over
> from the previous scan.
> 
> A single bit would be enough to decide this; but we got it troublesomely
> wrong in the early days of KSM (didn't always visit every rmap_item each
> scan), so it's convenient to use 8 bits (the low unsigned char, stored

When the scenario didn't always visit every rmap_item each scan can
occur? 

> below the FLAGs and below the page-aligned address in the rmap_item -
> there's lots of them, best keep them as small as we can) and do a
> BUG_ON(age > 1) if we made a mistake.
> 
> We haven't hit that BUG_ON in over three years: if we need some more
> bits for something, we can cut the age down to one or two bits.
> 
> Hugh



  reply	other threads:[~2013-01-04  0:24 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-24  3:22 [PATCH v6] KSM: numa awareness sysfs knob Petr Holasek
2012-12-24  3:22 ` Petr Holasek
2012-12-24  5:08 ` Greg KH
2012-12-24  5:08   ` Greg KH
2012-12-28  1:32   ` [PATCH v7 1/2] " Petr Holasek
2012-12-28  1:32     ` Petr Holasek
2012-12-28  1:32     ` [PATCH v7 2/2] Documentation: add sysfs ABI documentation for ksm Petr Holasek
2012-12-28  1:32       ` Petr Holasek
2013-01-01  4:41     ` [PATCH v7 1/2] KSM: numa awareness sysfs knob Simon Jeons
2013-01-01  4:41       ` Simon Jeons
2013-01-03 12:24       ` Petr Holasek
2013-01-03 12:24         ` Petr Holasek
2013-01-08  1:40         ` Simon Jeons
2013-01-08  1:40           ` Simon Jeons
2013-01-08  2:46           ` Hugh Dickins
2013-01-08  2:46             ` Hugh Dickins
2013-01-01  8:46     ` Simon Jeons
2013-01-01  8:46       ` Simon Jeons
2013-01-03  5:10       ` Hugh Dickins
2013-01-03  5:10         ` Hugh Dickins
2013-01-04  0:24         ` Simon Jeons [this message]
2013-01-04  0:24           ` Simon Jeons
2013-01-04 23:03           ` Hugh Dickins
2013-01-04 23:03             ` Hugh Dickins
2013-01-05  0:30             ` Simon Jeons
2013-01-05  0:30               ` Simon Jeons

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=1357259044.4930.4.camel@kernel.cn.ibm.com \
    --to=simon.jeons@gmail.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=anton@redhat.com \
    --cc=hughd@google.com \
    --cc=izik.eidus@ravellosystems.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=pholasek@redhat.com \
    --cc=riel@redhat.com \
    --cc=rientjes@google.com \
    --cc=sasha.levin@oracle.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.