From: Hugh Dickins <hughd@google.com>
To: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>,
linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
Andrea Arcangeli <aarcange@redhat.com>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
Hillf Danton <dhillf@gmail.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] memcg: fix mapcount check in move charge code for anonymous page
Date: Tue, 6 Mar 2012 12:55:42 -0800 (PST) [thread overview]
Message-ID: <alpine.LSU.2.00.1203061230530.17934@eggly.anvils> (raw)
In-Reply-To: <20120305091719.c9f93f1a.nishimura@mxp.nes.nec.co.jp>
On Mon, 5 Mar 2012, Daisuke Nishimura wrote:
> Hi, Horiguchi-san.
> On Fri, 2 Mar 2012 15:35:08 -0500
> Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> wrote:
>
> > Currently charge on shared anonyous pages is supposed not to moved
> > in task migration. To implement this, we need to check that mapcount > 1,
> > instread of > 2. So this patch fixes it.
> >
> > Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> > ---
> > mm/memcontrol.c | 2 +-
> > 1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git linux-next-20120228.orig/mm/memcontrol.c linux-next-20120228/mm/memcontrol.c
> > index b6d1bab..785f6d3 100644
> > --- linux-next-20120228.orig/mm/memcontrol.c
> > +++ linux-next-20120228/mm/memcontrol.c
> > @@ -5102,7 +5102,7 @@ static struct page *mc_handle_present_pte(struct vm_area_struct *vma,
> > return NULL;
> > if (PageAnon(page)) {
> > /* we don't move shared anon */
> > - if (!move_anon() || page_mapcount(page) > 2)
> > + if (!move_anon() || page_mapcount(page) > 1)
> > return NULL;
> > } else if (!move_file())
> > /* we ignore mapcount for file pages */
> > --
> > 1.7.7.6
> >
> Sorry, it's my fault..
> Thank you for catching this.
>
> Reviewed-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
I'm perversely sorry to see this fix already wing its way into 3.3-rc,
but never mind.
I was puzzling over that same "> 2" test when thinking through the
stats move locking, and again when swap accounting appeared to be
broken through and through (now fixed by two-liner in page_cgroup.c).
Why is there any test on page_mapcount(page) there at all?
2.6.34 comments it
* TODO: We don't move charges of shared(used by multiple
* processes) pages for now.
as if it's an unwelcome restriction to be eliminated later.
I don't understand why it was ever there, and would like to remove
it (and update the Documentation file) - just to remove a little
unnecessary complication, including mem_cgroup_count_swap_user().
The file case moves account, even when the page is not mapped into
this address space, even when it's mapped into a thousand others.
Why treat the anonymous so differently here? I'd have thought it
quite likely (by no means certain, but quite likely) that when you
move a task sharing an anon page from one cg to another, you'll
move the other task(s) sharing it immediately after - strange that
these shared pages should then get left behind.
I was pleased by the "> 2" bug, there almost all the life of
move_charge_at_immigrate, demonstrating that nobody was depending
upon the documented behaviour.
I've a few more cleanups in the swap accounting area, I guess I
should just post this change along with them and we discuss then,
unless you can enlighten me what it's about before I get there.
Thanks,
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/ .
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:[~2012-03-06 20:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-02 20:35 Naoya Horiguchi
2012-03-05 0:17 ` Daisuke Nishimura
2012-03-06 20:55 ` Hugh Dickins [this message]
2012-03-06 23:31 ` Naoya Horiguchi
2012-03-07 1:29 ` Hugh Dickins
2012-03-08 6:08 ` KAMEZAWA Hiroyuki
2012-03-08 5:48 ` KAMEZAWA Hiroyuki
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.1203061230530.17934@eggly.anvils \
--to=hughd@google.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=dhillf@gmail.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=n-horiguchi@ah.jp.nec.com \
--cc=nishimura@mxp.nes.nec.co.jp \
/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