linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Balbir Singh <balbir@linux.vnet.ibm.com>
To: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	kamezawa.hiroyu@jp.fujitsu.com, kosaki.motohiro@jp.fujitsu.com,
	menage@google.com, prarit@redhat.com, andi.kleen@intel.com,
	xemul@openvz.org, lizf@cn.fujitsu.com,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH] Help Resource Counters Scale better (v4.1)
Date: Thu, 13 Aug 2009 09:03:35 +0530	[thread overview]
Message-ID: <20090813033335.GF5087@balbir.in.ibm.com> (raw)
In-Reply-To: <20090813100350.bc09c568.nishimura@mxp.nes.nec.co.jp>

* nishimura@mxp.nes.nec.co.jp <nishimura@mxp.nes.nec.co.jp> [2009-08-13 10:03:50]:

> > @@ -1855,9 +1883,14 @@ __mem_cgroup_uncharge_common(struct page *page, enum charge_type ctype)
> >  		break;
> >  	}
> >  
> > -	res_counter_uncharge(&mem->res, PAGE_SIZE, &soft_limit_excess);
> > -	if (do_swap_account && (ctype != MEM_CGROUP_CHARGE_TYPE_SWAPOUT))
> > -		res_counter_uncharge(&mem->memsw, PAGE_SIZE, NULL);
> > +	if (!mem_cgroup_is_root(mem)) {
> > +		res_counter_uncharge(&mem->res, PAGE_SIZE, &soft_limit_excess);
> > +		if (do_swap_account &&
> > +				(ctype != MEM_CGROUP_CHARGE_TYPE_SWAPOUT))
> > +			res_counter_uncharge(&mem->memsw, PAGE_SIZE, NULL);
> > +	}
> > +	if (ctype == MEM_CGROUP_CHARGE_TYPE_SWAPOUT && mem_cgroup_is_root(mem))
> > +		mem_cgroup_swap_statistics(mem, true);
> I think mem_cgroup_is_root(mem) would be unnecessary here.
> Otherwise, MEM_CGROUP_STAT_SWAPOUT of groups except root memcgroup wouldn't
> be counted properly.
> 

I think you have a valid point, but it will not impact us currently
since we use SWAPOUT only for root accounting.

> 
> > @@ -2461,10 +2496,26 @@ static u64 mem_cgroup_read(struct cgroup *cont, struct cftype *cft)
> >  	name = MEMFILE_ATTR(cft->private);
> >  	switch (type) {
> >  	case _MEM:
> > -		val = res_counter_read_u64(&mem->res, name);
> > +		if (name == RES_USAGE && mem_cgroup_is_root(mem)) {
> > +			val = mem_cgroup_read_stat(&mem->stat,
> > +					MEM_CGROUP_STAT_CACHE);
> > +			val += mem_cgroup_read_stat(&mem->stat,
> > +					MEM_CGROUP_STAT_RSS);
> > +			val <<= PAGE_SHIFT;
> > +		} else
> > +			val = res_counter_read_u64(&mem->res, name);
> >  		break;
> >  	case _MEMSWAP:
> > -		val = res_counter_read_u64(&mem->memsw, name);
> > +		if (name == RES_USAGE && mem_cgroup_is_root(mem)) {
> > +			val = mem_cgroup_read_stat(&mem->stat,
> > +					MEM_CGROUP_STAT_CACHE);
> > +			val += mem_cgroup_read_stat(&mem->stat,
> > +					MEM_CGROUP_STAT_RSS);
> > +			val += mem_cgroup_read_stat(&mem->stat,
> > +					MEM_CGROUP_STAT_SWAPOUT);
> > +			val <<= PAGE_SHIFT;
> > +		} else
> > +			val = res_counter_read_u64(&mem->memsw, name);
> >  		break;
> >  	default:
> >  		BUG();
> Considering use_hierarchy==1 case in the root memcgroup, shouldn't we use
> mem_cgroup_walk_tree() here to sum up all the children's usage ?
> *.usage_in_bytes show sum of all the children's usage now if use_hierarchy==1.

If memory.use_hiearchy=1, we should use total_stats..right. Let me
send out a newer version for review.


-- 
	Balbir

--
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:[~2009-08-13  3:33 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-11 14:44 Help Resource Counters Scale better (v4) Balbir Singh
2009-08-11 14:54 ` Prarit Bhargava
2009-08-11 15:00   ` Balbir Singh
2009-08-11 15:11     ` Prarit Bhargava
2009-08-11 15:14   ` Prarit Bhargava
2009-08-11 15:20   ` Andi Kleen
2009-08-11 15:21     ` Prarit Bhargava
2009-08-11 16:52 ` Balbir Singh
2009-08-11 23:31 ` Andrew Morton
2009-08-12  2:34   ` Daisuke Nishimura
2009-08-12  3:56   ` Balbir Singh
2009-08-12  3:57   ` Balbir Singh
2009-08-12  4:57   ` [PATCH] Help Resource Counters Scale better (v4.1) Balbir Singh
2009-08-12 10:53     ` Prarit Bhargava
2009-08-12 16:19       ` KAMEZAWA Hiroyuki
2009-08-12 16:28     ` KAMEZAWA Hiroyuki
2009-08-12 17:19       ` Balbir Singh
2009-08-13  1:03     ` Daisuke Nishimura
2009-08-13  3:33       ` Balbir Singh [this message]
2009-08-13  5:08         ` Daisuke Nishimura

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=20090813033335.GF5087@balbir.in.ibm.com \
    --to=balbir@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi.kleen@intel.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=menage@google.com \
    --cc=nishimura@mxp.nes.nec.co.jp \
    --cc=prarit@redhat.com \
    --cc=xemul@openvz.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