From: Nai Xia <nai.xia@gmail.com>
To: Chris Wright <chrisw@sous-sol.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Izik Eidus <izik.eidus@ravellosystems.com>,
Andrea Arcangeli <aarcange@redhat.com>,
Hugh Dickins <hughd@google.com>,
Chris Wright <chrisw@sous-sol.org>,
Rik van Riel <riel@redhat.com>, "linux-mm" <linux-mm@kvack.org>,
Johannes Weiner <hannes@cmpxchg.org>,
"linux-kernel" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2 V2] ksm: take dirty bit as reference to avoid volatile pages scanning
Date: Wed, 22 Jun 2011 08:04:12 +0800 [thread overview]
Message-ID: <201106220804.12508.nai.xia@gmail.com> (raw)
In-Reply-To: <20110621223800.GO25383@sequoia.sous-sol.org>
(Sorry for repeated mail, I forgot to Cc the list..)
On Wednesday 22 June 2011 06:38:00 you wrote:
> * Nai Xia (nai.xia@gmail.com) wrote:
> > Introduced ksm_page_changed() to reference the dirty bit of a pte. We clear
> > the dirty bit for each pte scanned but don't flush the tlb. For a huge page,
> > if one of the subpage has changed, we try to skip the whole huge page
> > assuming(this is true by now) that ksmd linearly scans the address space.
>
> This doesn't build w/ kvm as a module.
I think it's because of the name-error of a related kvm patch, which I only sent
in a same email thread. http://marc.info/?l=linux-mm&m=130866318804277&w=2
The patch split is not clean...I'll redo it.
>
> > A NEW_FLAG is also introduced as a status of rmap_item to make ksmd scan
> > more aggressively for new VMAs - only skip the pages considered to be volatile
> > by the dirty bits. This can be enabled/disabled through KSM's sysfs interface.
>
> This seems like it should be separated out. And while it might be useful
> to enable/disable for testing, I don't think it's worth supporting for
> the long term. Would also be useful to see the value of this flag.
I think it maybe useful for uses who want to turn on/off this scan policy explicitly
according to their working sets?
>
> > @@ -454,7 +468,7 @@ static void remove_node_from_stable_tree(struct stable_node *stable_node)
> > else
> > ksm_pages_shared--;
> > put_anon_vma(rmap_item->anon_vma);
> > - rmap_item->address &= PAGE_MASK;
> > + rmap_item->address &= ~STABLE_FLAG;
> > cond_resched();
> > }
> >
> > @@ -542,7 +556,7 @@ static void remove_rmap_item_from_tree(struct rmap_item *rmap_item)
> > ksm_pages_shared--;
> >
> > put_anon_vma(rmap_item->anon_vma);
> > - rmap_item->address &= PAGE_MASK;
> > + rmap_item->address &= ~STABLE_FLAG;
> >
> > } else if (rmap_item->address & UNSTABLE_FLAG) {
> > unsigned char age;
> > @@ -554,12 +568,14 @@ static void remove_rmap_item_from_tree(struct rmap_item *rmap_item)
> > * than left over from before.
> > */
> > age = (unsigned char)(ksm_scan.seqnr - rmap_item->address);
> > - BUG_ON(age > 1);
> > + BUG_ON (age > 1);
>
> No need to add space after BUG_ON() there
>
> > +
> > if (!age)
> > rb_erase(&rmap_item->node, &root_unstable_tree);
> >
> > ksm_pages_unshared--;
> > - rmap_item->address &= PAGE_MASK;
> > + rmap_item->address &= ~UNSTABLE_FLAG;
> > + rmap_item->address &= ~SEQNR_MASK;
>
> None of these changes are needed AFAICT. &= PAGE_MASK clears all
> relevant bits. How could it be in a tree, have NEW_FLAG set, and
> while removing from tree want to preserve NEW_FLAG?
You are right, it's meaningless to preserve NEW_FLAG after it goes
through the trees. I'll revert the lines.
Thanks!
Nai
>
> thanks,
> -chris
>
WARNING: multiple messages have this Message-ID (diff)
From: Nai Xia <nai.xia@gmail.com>
To: Chris Wright <chrisw@sous-sol.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Izik Eidus <izik.eidus@ravellosystems.com>,
Andrea Arcangeli <aarcange@redhat.com>,
Hugh Dickins <hughd@google.com>, Rik van Riel <riel@redhat.com>,
linux-mm <linux-mm@kvack.org>,
Johannes Weiner <hannes@cmpxchg.org>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2 V2] ksm: take dirty bit as reference to avoid volatile pages scanning
Date: Wed, 22 Jun 2011 08:04:12 +0800 [thread overview]
Message-ID: <201106220804.12508.nai.xia@gmail.com> (raw)
In-Reply-To: <20110621223800.GO25383@sequoia.sous-sol.org>
(Sorry for repeated mail, I forgot to Cc the list..)
On Wednesday 22 June 2011 06:38:00 you wrote:
> * Nai Xia (nai.xia@gmail.com) wrote:
> > Introduced ksm_page_changed() to reference the dirty bit of a pte. We clear
> > the dirty bit for each pte scanned but don't flush the tlb. For a huge page,
> > if one of the subpage has changed, we try to skip the whole huge page
> > assuming(this is true by now) that ksmd linearly scans the address space.
>
> This doesn't build w/ kvm as a module.
I think it's because of the name-error of a related kvm patch, which I only sent
in a same email thread. http://marc.info/?l=linux-mm&m=130866318804277&w=2
The patch split is not clean...I'll redo it.
>
> > A NEW_FLAG is also introduced as a status of rmap_item to make ksmd scan
> > more aggressively for new VMAs - only skip the pages considered to be volatile
> > by the dirty bits. This can be enabled/disabled through KSM's sysfs interface.
>
> This seems like it should be separated out. And while it might be useful
> to enable/disable for testing, I don't think it's worth supporting for
> the long term. Would also be useful to see the value of this flag.
I think it maybe useful for uses who want to turn on/off this scan policy explicitly
according to their working sets?
>
> > @@ -454,7 +468,7 @@ static void remove_node_from_stable_tree(struct stable_node *stable_node)
> > else
> > ksm_pages_shared--;
> > put_anon_vma(rmap_item->anon_vma);
> > - rmap_item->address &= PAGE_MASK;
> > + rmap_item->address &= ~STABLE_FLAG;
> > cond_resched();
> > }
> >
> > @@ -542,7 +556,7 @@ static void remove_rmap_item_from_tree(struct rmap_item *rmap_item)
> > ksm_pages_shared--;
> >
> > put_anon_vma(rmap_item->anon_vma);
> > - rmap_item->address &= PAGE_MASK;
> > + rmap_item->address &= ~STABLE_FLAG;
> >
> > } else if (rmap_item->address & UNSTABLE_FLAG) {
> > unsigned char age;
> > @@ -554,12 +568,14 @@ static void remove_rmap_item_from_tree(struct rmap_item *rmap_item)
> > * than left over from before.
> > */
> > age = (unsigned char)(ksm_scan.seqnr - rmap_item->address);
> > - BUG_ON(age > 1);
> > + BUG_ON (age > 1);
>
> No need to add space after BUG_ON() there
>
> > +
> > if (!age)
> > rb_erase(&rmap_item->node, &root_unstable_tree);
> >
> > ksm_pages_unshared--;
> > - rmap_item->address &= PAGE_MASK;
> > + rmap_item->address &= ~UNSTABLE_FLAG;
> > + rmap_item->address &= ~SEQNR_MASK;
>
> None of these changes are needed AFAICT. &= PAGE_MASK clears all
> relevant bits. How could it be in a tree, have NEW_FLAG set, and
> while removing from tree want to preserve NEW_FLAG?
You are right, it's meaningless to preserve NEW_FLAG after it goes
through the trees. I'll revert the lines.
Thanks!
Nai
>
> thanks,
> -chris
>
--
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>
next prev parent reply other threads:[~2011-06-22 0:04 UTC|newest]
Thread overview: 96+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-21 12:55 [PATCH 0/2 V2] ksm: take dirty bit as reference to avoid volatile pages scanning Nai Xia
2011-06-21 12:55 ` Nai Xia
2011-06-21 13:26 ` [PATCH 1/2 " Nai Xia
2011-06-21 13:26 ` Nai Xia
2011-06-21 21:42 ` Chris Wright
2011-06-21 21:42 ` Chris Wright
2011-06-22 0:02 ` Nai Xia
2011-06-22 0:02 ` Nai Xia
2011-06-22 0:42 ` Chris Wright
2011-06-22 0:42 ` Chris Wright
2011-06-21 13:32 ` [PATCH] mmu_notifier, kvm: Introduce dirty bit tracking in spte and mmu notifier to help KSM dirty bit tracking Nai Xia
2011-06-21 13:32 ` Nai Xia
2011-06-22 0:21 ` Chris Wright
2011-06-22 0:21 ` Chris Wright
2011-06-22 4:43 ` Nai Xia
2011-06-22 4:43 ` Nai Xia
2011-06-22 6:15 ` Izik Eidus
2011-06-22 6:15 ` Izik Eidus
2011-06-22 6:38 ` Nai Xia
2011-06-22 6:38 ` Nai Xia
2011-06-22 15:46 ` Chris Wright
2011-06-22 15:46 ` Chris Wright
2011-06-22 10:43 ` Avi Kivity
2011-06-22 10:43 ` Avi Kivity
2011-06-22 11:05 ` Izik Eidus
2011-06-22 11:05 ` Izik Eidus
2011-06-22 11:10 ` Avi Kivity
2011-06-22 11:10 ` Avi Kivity
2011-06-22 11:19 ` Izik Eidus
2011-06-22 11:19 ` Izik Eidus
2011-06-22 11:24 ` Avi Kivity
2011-06-22 11:24 ` Avi Kivity
2011-06-22 11:28 ` Avi Kivity
2011-06-22 11:28 ` Avi Kivity
2011-06-22 11:31 ` Avi Kivity
2011-06-22 11:31 ` Avi Kivity
2011-06-22 11:33 ` Nai Xia
2011-06-22 11:33 ` Nai Xia
2011-06-22 11:39 ` Izik Eidus
2011-06-22 11:39 ` Izik Eidus
2011-06-22 15:39 ` Rik van Riel
2011-06-22 15:39 ` Rik van Riel
2011-06-22 16:55 ` Andrea Arcangeli
2011-06-22 16:55 ` Andrea Arcangeli
2011-06-22 23:37 ` Nai Xia
2011-06-22 23:37 ` Nai Xia
2011-06-22 23:59 ` Andrea Arcangeli
2011-06-22 23:59 ` Andrea Arcangeli
2011-06-23 0:31 ` Nai Xia
2011-06-23 0:31 ` Nai Xia
2011-06-23 0:44 ` Andrea Arcangeli
2011-06-23 0:44 ` Andrea Arcangeli
2011-06-23 1:36 ` Nai Xia
2011-06-23 1:36 ` Nai Xia
2011-06-23 0:00 ` Rik van Riel
2011-06-23 0:00 ` Rik van Riel
2011-06-23 0:42 ` Nai Xia
2011-06-23 0:42 ` Nai Xia
2011-06-22 23:13 ` Nai Xia
2011-06-22 23:13 ` Nai Xia
2011-06-22 23:25 ` Andrea Arcangeli
2011-06-22 23:25 ` Andrea Arcangeli
2011-06-23 1:30 ` Nai Xia
2011-06-23 1:30 ` Nai Xia
2011-06-22 23:28 ` Rik van Riel
2011-06-22 23:28 ` Rik van Riel
2011-06-23 0:52 ` Nai Xia
2011-06-23 0:52 ` Nai Xia
2011-06-22 11:24 ` Nai Xia
2011-06-22 15:03 ` Andrea Arcangeli
2011-06-22 15:03 ` Andrea Arcangeli
2011-06-22 15:19 ` Izik Eidus
2011-06-22 15:19 ` Izik Eidus
2011-06-22 23:19 ` Nai Xia
2011-06-22 23:19 ` Nai Xia
2011-06-22 23:44 ` Andrea Arcangeli
2011-06-22 23:44 ` Andrea Arcangeli
2011-06-23 0:14 ` Nai Xia
2011-06-23 0:14 ` Nai Xia
2011-06-22 23:42 ` Nai Xia
2011-06-22 23:42 ` Nai Xia
2011-06-21 13:36 ` [PATCH 2/2 V2] ksm: take dirty bit as reference to avoid volatile pages scanning Nai Xia
2011-06-21 13:36 ` Nai Xia
2011-06-21 22:38 ` Chris Wright
2011-06-21 22:38 ` Chris Wright
2011-06-22 0:04 ` Nai Xia [this message]
2011-06-22 0:04 ` Nai Xia
2011-06-22 0:35 ` Chris Wright
2011-06-22 0:35 ` Chris Wright
2011-06-22 4:47 ` Nai Xia
2011-06-22 4:47 ` Nai Xia
2011-06-22 10:55 ` Nai Xia
2011-06-22 10:55 ` Nai Xia
2011-06-22 0:46 ` [PATCH 0/2 " Chris Wright
2011-06-22 0:46 ` Chris Wright
2011-06-22 4:15 ` Nai Xia
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=201106220804.12508.nai.xia@gmail.com \
--to=nai.xia@gmail.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=chrisw@sous-sol.org \
--cc=hannes@cmpxchg.org \
--cc=hughd@google.com \
--cc=izik.eidus@ravellosystems.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=riel@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 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.