From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
To: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Cc: balbir@linux.vnet.ibm.com,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
Andrew Morton <akpm@linux-foundation.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [RFC] Shared page accounting for memory cgroup
Date: Wed, 20 Jan 2010 16:43:02 +0900 [thread overview]
Message-ID: <20100120164302.f05a91ef.kamezawa.hiroyu@jp.fujitsu.com> (raw)
In-Reply-To: <20100120161533.6d83f607.nishimura@mxp.nes.nec.co.jp>
On Wed, 20 Jan 2010 16:15:33 +0900
Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> wrote:
> > I would agree with you if you add interfaces to show some hints to users about above values,
> > but "shared_usage_in_bytes" doesn't meet it at all.
> >
> This is just an idea(At least, we need interfaces to read and reset them).
>
seems atractive but there is no way to decrement this counter in _scalable_ way.
We need some inovation to go this way.
But I doubt how this comes to be useful.
In general, we can assume
- file is shared. (because of their nature.)
- rss is private. (because of thier nature.)
Then, the problem is how rss(private anon) is shared.
Except for crazy progam as AIM7, rss is private in many case.
Even if highly shared, in most case, shared rss can be estimated by the size
of parent process's rss. And processe's parent-child relationship is appearent.
Measurement is easy. If COW is troublesome, counting # of COW per process
is reasonable way. (But you have to fight with the cost of adding that.)
I tend not to disagree to add a counter to show "shared with other cgroup"
but disagree "shared between process".
Thanks,
-Kame
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 385e29b..bf601f2 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -83,6 +83,8 @@ enum mem_cgroup_stat_index {
> used by soft limit implementation */
> MEM_CGROUP_STAT_THRESHOLDS, /* decrements on each page in/out.
> used by threshold implementation */
> + MEM_CGROUP_STAT_SHARED_IN_GROUP,
> + MEM_CGROUP_STAT_SHARED_FROM_OTHERS,
>
> MEM_CGROUP_STAT_NSTATS,
> };
> @@ -1707,8 +1709,25 @@ static void __mem_cgroup_commit_charge(struct mem_cgroup *mem,
>
> lock_page_cgroup(pc);
> if (unlikely(PageCgroupUsed(pc))) {
> + struct mem_cgroup *charged = pc->mem_cgroup;
> + struct mem_cgroup_stat *stat;
> + struct mem_cgroup_stat_cpu *cpustat;
> + int cpu;
> + int shared_type;
> +
> unlock_page_cgroup(pc);
> mem_cgroup_cancel_charge(mem);
> +
> + stat = &charged->stat;
> + cpu = get_cpu();
> + cpustat = &stat->cpustat[cpu];
> + if (charged == mem)
> + shared_type = MEM_CGROUP_STAT_SHARED_IN_GROUP;
> + else
> + shared_type = MEM_CGROUP_STAT_SHARED_FROM_OTHERS;
> + __mem_cgroup_stat_add_safe(cpustat, shared_type, 1);
> + put_cpu();
> +
> return;
> }
>
>
--
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>
next prev parent reply other threads:[~2010-01-20 7:46 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-29 18:27 Balbir Singh
2010-01-03 23:51 ` KAMEZAWA Hiroyuki
2010-01-04 0:07 ` Balbir Singh
2010-01-04 0:35 ` KAMEZAWA Hiroyuki
2010-01-04 0:50 ` Balbir Singh
2010-01-06 4:02 ` KAMEZAWA Hiroyuki
2010-01-06 7:01 ` Balbir Singh
2010-01-06 7:12 ` KAMEZAWA Hiroyuki
2010-01-07 7:15 ` Balbir Singh
2010-01-07 7:36 ` KAMEZAWA Hiroyuki
2010-01-07 8:34 ` Balbir Singh
2010-01-07 8:48 ` KAMEZAWA Hiroyuki
2010-01-07 9:08 ` KAMEZAWA Hiroyuki
2010-01-07 9:27 ` Balbir Singh
2010-01-07 23:47 ` KAMEZAWA Hiroyuki
2010-01-17 19:30 ` Balbir Singh
2010-01-18 0:05 ` KAMEZAWA Hiroyuki
2010-01-18 0:22 ` KAMEZAWA Hiroyuki
2010-01-18 0:49 ` Daisuke Nishimura
2010-01-18 8:26 ` Balbir Singh
2010-01-19 1:22 ` Daisuke Nishimura
2010-01-19 1:49 ` Balbir Singh
2010-01-19 2:34 ` Daisuke Nishimura
2010-01-19 3:52 ` Balbir Singh
2010-01-20 4:09 ` Daisuke Nishimura
2010-01-20 7:15 ` Daisuke Nishimura
2010-01-20 7:43 ` KAMEZAWA Hiroyuki [this message]
2010-01-20 8:18 ` Balbir Singh
2010-01-20 8:17 ` Balbir Singh
2010-01-21 1:04 ` Daisuke Nishimura
2010-01-21 1:30 ` 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=20100120164302.f05a91ef.kamezawa.hiroyu@jp.fujitsu.com \
--to=kamezawa.hiroyu@jp.fujitsu.com \
--cc=akpm@linux-foundation.org \
--cc=balbir@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--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