From: Balbir Singh <balbir@linux.vnet.ibm.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Li Zefan <lizf@cn.fujitsu.com>,
Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>,
"linux-mm@kvack.org" <linux-mm@kvack.org>
Subject: Re: [RFC] [PATCH] memcg: fix infinite loop
Date: Thu, 15 Jan 2009 12:56:11 +0530 [thread overview]
Message-ID: <20090115072611.GE30358@balbir.in.ibm.com> (raw)
In-Reply-To: <20090115162126.cf040c63.kamezawa.hiroyu@jp.fujitsu.com>
* KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> [2009-01-15 16:21:26]:
> On Thu, 15 Jan 2009 15:14:38 +0800
> Li Zefan <lizf@cn.fujitsu.com> wrote:
>
> > KAMEZAWA Hiroyuki wrote:
> > > On Thu, 15 Jan 2009 11:45:57 +0530
> > > Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
> > >
> > >> * Li Zefan <lizf@cn.fujitsu.com> [2009-01-15 14:07:51]:
> > >>
> > >>> 1. task p1 is in /memcg/0
> > >>> 2. p1 does mmap(4096*2, MAP_LOCKED)
> > >>> 3. echo 4096 > /memcg/0/memory.limit_in_bytes
> > >>>
> > >>> The above 'echo' will never return, unless p1 exited or freed the memory.
> > >>> The cause is we can't reclaim memory from p1, so the while loop in
> > >>> mem_cgroup_resize_limit() won't break.
> > >>>
> > >>> This patch fixes it by decrementing retry_count regardless the return value
> > >>> of mem_cgroup_hierarchical_reclaim().
> > >>>
> > >> The problem definitely seems to exist, shouldn't we fix reclaim to
> > >> return 0, so that we know progress is not made and retry count
> > >> decrements?
> > >>
> > >
> > > The behavior is correct. And we already check signal_pending() in the loop.
> > > Ctrl-C or SIGALARM will works better than checking retry count.
> >
> > But this behavior seems like a regression. Please try it in 2.6.28, you'll see
> > it returns EBUSY immediately.
> >
> > Looks like the return value of mem_cgroup_hierarchical_reclaim() is buggy ?
> >
>
> This is intentional behavior change by
> ==
> memcg-make-oom-less-frequently.patch
> ==
>
> try_to_free_page() returns positive value if try_to_free_page() reclaims at
> least 1 pages. It itself doesn't seem to be buggy.
>
> What buggy is resize_limit's retry-out check code, I think.
>
> How about following ?
> ==
> while (1) {
> if (signal_pending())
> break;
> try to set limit ....
> ...
> ret = mem_cgroup_hierarchical_reclaim(memcg, GFP_KERNEL, false);
> total_progress += ret;
>
> if (total_progress > (memcg->res.usage - val) * 2) {
> /*
> * It seems we reclaimed twice of necessary
> * pages...this memcg is busy
> */
> ret = -EBUSY;
> break;
I think we need the nr_retries here as well, we should refuse to
resize_limit beyond a certain number of retries. In the case that Li
mentioned total_progress will be 0, since we cannot reclaim anything.
I prefer a nr_retries based approach for failure.
> }
> }
> ==
>
> Thanks,
> -Kame
>
>
>
>
>
>
>
>
> --
> 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>
--
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>
next prev parent reply other threads:[~2009-01-15 7:49 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-15 6:07 [RFC] [PATCH] memcg: fix infinite loop Li Zefan
2009-01-15 6:15 ` Balbir Singh
2009-01-15 6:31 ` KAMEZAWA Hiroyuki
2009-01-15 7:14 ` Li Zefan
2009-01-15 7:21 ` KAMEZAWA Hiroyuki
2009-01-15 7:26 ` Balbir Singh [this message]
2009-01-15 7:32 ` Li Zefan
2009-01-15 7:35 ` KAMEZAWA Hiroyuki
2009-01-15 6:16 ` Daisuke Nishimura
2009-01-15 6:27 ` Li Zefan
2009-01-19 8:49 ` KAMEZAWA Hiroyuki
2009-01-19 9:57 ` Balbir Singh
2009-01-19 10:07 ` 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=20090115072611.GE30358@balbir.in.ibm.com \
--to=balbir@linux.vnet.ibm.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-mm@kvack.org \
--cc=lizf@cn.fujitsu.com \
--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;
as well as URLs for NNTP newsgroup(s).