linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@suse.cz>
To: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Cc: linux-mm <linux-mm@kvack.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Balbir Singh <bsingharora@gmail.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Ying Han <yinghan@google.com>
Subject: Re: [PATCH] memcg: fix behavior of mem_cgroup_resize_limit()
Date: Mon, 25 Jul 2011 15:47:40 +0200	[thread overview]
Message-ID: <20110725134740.GD9445@tiehlicka.suse.cz> (raw)
In-Reply-To: <20110722111703.241caf72.nishimura@mxp.nes.nec.co.jp>

On Fri 22-07-11 11:17:03, Daisuke Nishimura wrote:
> commit:22a668d7 introduced "memsw_is_minimum" flag, which becomes true when
> mem_limit == memsw_limit. The flag is checked at the beginning of reclaim,
> and "noswap" is set if the flag is true, because using swap is meaningless
> in this case.
> 
> This works well in most cases, but when we try to shrink mem_limit, which
> is the same as memsw_limit now, we might fail to shrink mem_limit because
> swap doesn't used.
> 
> This patch fixes this behavior by:
> - check MEM_CGROUP_RECLAIM_SHRINK at the begining of reclaim
> - If it is set, don't set "noswap" flag even if memsw_is_minimum is true.
> 
> Signed-off-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
> ---
>  mm/memcontrol.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index ce0d617..cf6bae8 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -1649,7 +1649,7 @@ static int mem_cgroup_hierarchical_reclaim(struct mem_cgroup *root_mem,
>  	excess = res_counter_soft_limit_excess(&root_mem->res) >> PAGE_SHIFT;
>  
>  	/* If memsw_is_minimum==1, swap-out is of-no-use. */
> -	if (!check_soft && root_mem->memsw_is_minimum)
> +	if (!check_soft && !shrink && root_mem->memsw_is_minimum)

It took me a while until I understood how we can end up having both
flags unset - because I saw them as complementary before. But this is
the mem_cgroup_do_charge path that is affected.

Btw. shouldn't we push that check into the loop. We could catch also
memsw changes done (e.g. increased memsw limit in order to cope with the
current workload) while we were reclaiming from a subgroup.

Anyway looks good.
Reviewed-by: Michal Hocko <mhocko@suse.cz>
-- 
Michal Hocko
SUSE Labs
SUSE LINUX s.r.o.
Lihovarska 1060/12
190 00 Praha 9    
Czech Republic

--
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>

  parent reply	other threads:[~2011-07-25 13:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-22  2:17 Daisuke Nishimura
2011-07-22  2:14 ` KAMEZAWA Hiroyuki
2011-07-25 13:47 ` Michal Hocko [this message]
2011-07-26  5:35   ` Daisuke Nishimura
2011-07-26 13:12     ` Michal Hocko

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=20110725134740.GD9445@tiehlicka.suse.cz \
    --to=mhocko@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=bsingharora@gmail.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-mm@kvack.org \
    --cc=nishimura@mxp.nes.nec.co.jp \
    --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