linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@suse.cz>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: linux-mm@kvack.org, Ying Han <yinghan@google.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Rik van Riel <riel@redhat.com>, Hugh Dickins <hughd@google.com>,
	Mel Gorman <mgorman@suse.de>,
	Glauber Costa <glommer@parallels.com>
Subject: Re: [RFC 2/3] memcg: Ignore soft limit until it is explicitly specified
Date: Tue, 9 Apr 2013 15:42:15 +0200	[thread overview]
Message-ID: <20130409134215.GI29860@dhcp22.suse.cz> (raw)
In-Reply-To: <20130409132406.GQ1953@cmpxchg.org>

On Tue 09-04-13 09:24:06, Johannes Weiner wrote:
> On Tue, Apr 09, 2013 at 02:13:14PM +0200, Michal Hocko wrote:
[...]
> > @@ -2062,14 +2066,15 @@ static bool mem_cgroup_reclaimable(struct mem_cgroup *memcg, bool noswap)
> >  
> >  /*
> >   * A group is eligible for the soft limit reclaim if it is
> > - * 	a) is over its soft limit
> > - * 	b) any parent up the hierarchy is over its soft limit
> > + * 	a) doesn't have any soft limit set
> > + * 	b) is over its soft limit
> > + * 	c) any parent up the hierarchy is over its soft limit
> >   */
> >  bool mem_cgroup_soft_reclaim_eligible(struct mem_cgroup *memcg)
> >  {
> >  	struct mem_cgroup *parent = memcg;
> >  
> > -	if (res_counter_soft_limit_excess(&memcg->res))
> > +	if (!memcg->soft_limited || res_counter_soft_limit_excess(&memcg->res))
> >  		return true;
> 
> With the very similar condition in the hierarchy walk down there, this
> was more confusing than I would have expected it to be.
> 
> Would you mind splitting this check and putting the comments directly
> over the individual checks?
> 
> 	/* No specific soft limit set, eligible for soft reclaim */
> 	if (!memcg->soft_limited)
> 		return true;
> 
> 	/* Soft limit exceeded, eligible for soft reclaim */
> 	if (res_counter_soft_limit_excess(&memcg->res))
> 		return true;
> 
> 	/* Parental limit exceeded, eligible for... soft reclaim! */

Sure thing.

> 	...
> 
> > @@ -2077,7 +2082,8 @@ bool mem_cgroup_soft_reclaim_eligible(struct mem_cgroup *memcg)
> >  	 * have to obey and reclaim from this group as well.
> >  	 */
> >  	while((parent = parent_mem_cgroup(parent))) {
> > -		if (res_counter_soft_limit_excess(&parent->res))
> > +		if (memcg->soft_limited &&
> > +				res_counter_soft_limit_excess(&parent->res))
> >  			return true;
> 
> Should this be parent->soft_limited instead of memcg->softlimited?

Yes. I haven't tested with deeper hierarchies yet... Thanks for catching
this.

> 
> > @@ -5237,6 +5243,14 @@ static int mem_cgroup_write(struct cgroup *cont, struct cftype *cft,
> >  			ret = res_counter_set_soft_limit(&memcg->res, val);
> >  		else
> >  			ret = -EINVAL;
> > +
> > +		/*
> > +		 * We could disable soft_limited when we get RESOURCE_MAX but
> > +		 * then we have a little problem to distinguish the default
> > +		 * unlimited and limitted but never soft reclaimed groups.
> > +		 */
> > +		if (!ret)
> > +			memcg->soft_limited = true;
> 
> It's neither reversible nor distinguishable from userspace, so it
> would be good to either find a value or just make the soft_limited
> knob explicit and accessible from userspace.

I can export the knob but I would like to prevent from that if possible.
So far it seems it would be hard to keep backward compatibility. I hoped
somebody would come up with something clever ;)

One possible way would be returning -1 if soft_limited == false. Users
who use u64 would see the same value in the end so they shouldn't break
and those that are _really_ interested can check the string value as
well. What do you think?

-- 
Michal Hocko
SUSE Labs

--
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:[~2013-04-09 13:42 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-09 12:13 [RFC 0/3] soft reclaim rework Michal Hocko
2013-04-09 12:13 ` [RFC 1/3] memcg: integrate soft reclaim tighter with zone shrinking code Michal Hocko
2013-04-09 13:08   ` Johannes Weiner
2013-04-09 13:31     ` Michal Hocko
2013-04-09 13:57   ` Glauber Costa
2013-04-09 14:22     ` Michal Hocko
2013-04-09 16:45   ` Kamezawa Hiroyuki
2013-04-09 17:05     ` Michal Hocko
2013-04-14  0:42   ` Mel Gorman
2013-04-14 14:34     ` Michal Hocko
2013-04-14 14:55       ` Johannes Weiner
2013-04-14 15:04         ` Michal Hocko
2013-04-14 15:11           ` Michal Hocko
2013-04-14 18:03           ` Rik van Riel
2013-04-09 12:13 ` [RFC 2/3] memcg: Ignore soft limit until it is explicitly specified Michal Hocko
2013-04-09 13:24   ` Johannes Weiner
2013-04-09 13:42     ` Michal Hocko [this message]
2013-04-09 17:10   ` Kamezawa Hiroyuki
2013-04-09 17:22     ` Michal Hocko
2013-04-09 12:13 ` [RFC 3/3] vmscan, memcg: Do softlimit reclaim also for targeted reclaim Michal Hocko
2013-04-22  2:14   ` Michal Hocko
2013-04-09 15:37 ` [RFC 0/3] soft reclaim rework Michal Hocko
2013-04-09 15:50   ` Michal Hocko
2013-04-11  8:43 ` Michal Hocko
2013-04-11  9:07   ` Michal Hocko
2013-04-11 13:04   ` Michal Hocko
2013-04-17 22:52 ` Ying Han

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=20130409134215.GI29860@dhcp22.suse.cz \
    --to=mhocko@suse.cz \
    --cc=glommer@parallels.com \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=riel@redhat.com \
    --cc=yinghan@google.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