linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Balbir Singh <balbir@linux.vnet.ibm.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, lizf@cn.fujitsu.com,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Subject: Re: [RFC][PATCH 5/5] Memory controller soft limit reclaim on contention (v8)
Date: Fri, 10 Jul 2009 16:26:20 +0530	[thread overview]
Message-ID: <20090710105620.GI20129@balbir.in.ibm.com> (raw)
In-Reply-To: <20090710074906.GE20129@balbir.in.ibm.com>

* Balbir Singh <balbir@linux.vnet.ibm.com> [2009-07-10 13:19:06]:

> * KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> [2009-07-10 16:30:56]:
> 
> > On Fri, 10 Jul 2009 12:23:06 +0530
> > Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
> > 
> > > * KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> [2009-07-10 14:30:26]:
> > > 
> > > > On Thu, 09 Jul 2009 22:45:12 +0530
> > > > Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
> > > > 
> > > > > Feature: Implement reclaim from groups over their soft limit
> > > > > 
> > > > > From: Balbir Singh <balbir@linux.vnet.ibm.com>
> > > > > -	while (loop < 2) {
> > > > > +	while (1) {
> > > > >  		victim = mem_cgroup_select_victim(root_mem);
> > > > > -		if (victim == root_mem)
> > > > > +		if (victim == root_mem) {
> > > > >  			loop++;
> > > > > +			if (loop >= 2) {
> > > > > +				/*
> > > > > +				 * If we have not been able to reclaim
> > > > > +				 * anything, it might because there are
> > > > > +				 * no reclaimable pages under this hierarchy
> > > > > +				 */
> > > > > +				if (!check_soft || !total)
> > > > > +					break;
> > > > > +				/*
> > > > > +				 * We want to do more targetted reclaim.
> > > > > +				 * excess >> 2 is not to excessive so as to
> > > > > +				 * reclaim too much, nor too less that we keep
> > > > > +				 * coming back to reclaim from this cgroup
> > > > > +				 */
> > > > > +				if (total >= (excess >> 2) ||
> > > > > +					(loop > MEM_CGROUP_MAX_RECLAIM_LOOPS))
> > > > > +					break;
> > > > > +			}
> > > > > +		}
> > > > 
> > > > Hmm..this logic is very unclear for me. Why just exit back as usual reclaim ?
> > > >
> > > 
> > > Basically what this check does is, it checks to see if the loops > 2,
> > > then as in the previous case (when soft limits were not supported)
> > > exit or if the total reclaimed is 0, exit (because we are running with
> > > swap turned off, may be?). Otherwise, check if we have reclaimed a
> > > certain portion of the total amount we exceed the soft limit by or if
> > > the loops are too large and exit. I hope this clarifies
> > >  
> > +#define	MEM_CGROUP_MAX_RECLAIM_LOOPS		(10000)
> > +#define	MEM_CGROUP_MAX_SOFT_LIMIT_RECLAIM_LOOPS	(2)
> > +
> > .....too big. 
> > 
> 
> Agreed, will cut it short
> 
> > IMO,
> > > > > +				if (total >= (excess >> 2) ||
> > > > > +					(loop > MEM_CGROUP_MAX_RECLAIM_LOOPS))
> > > > > +					break;
> > is unnecessary. Do you want to block kswapd here for such a long time ?
> > loops > 2 is definitely enough, I believe.
> > If you find out loops>2 is not enough later, just retrying soft limit is enough.
> > 
> 
> 
> Yes, worth experimenting with, I'll redo with the special code
> removed.


OK, so I experimented with it, I found the following behaviour

1. We try to reclaim, priority is high, scanned pages are low and
   hence memory cgroup zone reclaim returns 0 (no pages could be
   reclaimed).
2. Now regular reclaim from balance_pgdat() is called, it is able
   to shrink from global LRU and hence some other mem cgroup, thus
   breaking soft limit semantics.


> > > > > +			res_counter_soft_limit_excess(&mz->mem->res);
> > > > > +		__mem_cgroup_remove_exceeded(mz->mem, mz, stz);
> > > > > +		if (mz->usage_in_excess)
> > > > > +			__mem_cgroup_insert_exceeded(mz->mem, mz, stz);
> > > > 
> > > > plz don't push back "mz" if !reclaimd.
> > > >
> > > 
> > > We need to do that, what is someone does a swapoff -a and swapon -a in
> > > between, we still need to give mz a chance. No?
> > >  
> > kswapd's original behavior will work well in such special case, No ?
> > 
> > In !reclaimed case, loss to push it back is larger than benefit, I think.
> >
> 
> OK, I'll try it out. 
>

I tried, it did not work out well, please see above. 

-- 
	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-07-10 10:32 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-09 17:14 [RFC][PATCH 0/5] Memory controller soft limit patches (v8) Balbir Singh
2009-07-09 17:14 ` [RFC][PATCH 1/5] Memory controller soft limit documentation (v8) Balbir Singh
2009-07-10  5:32   ` KAMEZAWA Hiroyuki
2009-07-10  6:48     ` Balbir Singh
2009-07-09 17:14 ` [RFC][PATCH 2/5] Memory controller soft limit interface (v8) Balbir Singh
2009-07-09 17:15 ` [RFC][PATCH 3/5] Memory controller soft limit organize cgroups (v8) Balbir Singh
2009-07-10  5:21   ` KAMEZAWA Hiroyuki
2009-07-10  6:47     ` Balbir Singh
2009-07-10  7:16       ` KAMEZAWA Hiroyuki
2009-07-10  8:05     ` Balbir Singh
2009-07-10  8:14       ` KAMEZAWA Hiroyuki
2009-07-10  8:20         ` Balbir Singh
2009-07-09 17:15 ` [RFC][PATCH 4/5] Memory controller soft limit refactor reclaim flags (v8) Balbir Singh
2009-07-09 17:15 ` [RFC][PATCH 5/5] Memory controller soft limit reclaim on contention (v8) Balbir Singh
2009-07-10  5:30   ` KAMEZAWA Hiroyuki
2009-07-10  6:53     ` Balbir Singh
2009-07-10  7:30       ` KAMEZAWA Hiroyuki
2009-07-10  7:49         ` Balbir Singh
2009-07-10 10:56           ` Balbir Singh [this message]
2009-07-10 14:15             ` KAMEZAWA Hiroyuki
2009-07-10 14:22               ` Balbir Singh
2009-07-10  4:53 ` [RFC][PATCH 0/5] Memory controller soft limit patches (v8) KAMEZAWA Hiroyuki
2009-07-10  5:53   ` Balbir Singh

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=20090710105620.GI20129@balbir.in.ibm.com \
    --to=balbir@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-mm@kvack.org \
    --cc=lizf@cn.fujitsu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).