From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: akpm@linux-foundation.org, nishimura@mxp.nes.nec.co.jp,
balbir@linux.vnet.ibm.com, minchan.kim@gmail.com,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [patch 1/3] memcg: prevent endless loop when charging huge pages
Date: Tue, 1 Feb 2011 08:48:29 +0900 [thread overview]
Message-ID: <20110201084829.86b7290c.kamezawa.hiroyu@jp.fujitsu.com> (raw)
In-Reply-To: <1296482635-13421-2-git-send-email-hannes@cmpxchg.org>
On Mon, 31 Jan 2011 15:03:53 +0100
Johannes Weiner <hannes@cmpxchg.org> wrote:
> The charging code can encounter a charge size that is bigger than a
> regular page in two situations: one is a batched charge to fill the
> per-cpu stocks, the other is a huge page charge.
>
> This code is distributed over two functions, however, and only the
> outer one is aware of huge pages. In case the charging fails, the
> inner function will tell the outer function to retry if the charge
> size is bigger than regular pages--assuming batched charging is the
> only case. And the outer function will retry forever charging a huge
> page.
>
> This patch makes sure the inner function can distinguish between batch
> charging and a single huge page charge. It will only signal another
> attempt if batch charging failed, and go into regular reclaim when it
> is called on behalf of a huge page.
>
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Thank you very much.
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> ---
> mm/memcontrol.c | 11 +++++++++--
> 1 files changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index d572102..73ea323 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -1837,8 +1837,15 @@ static int __mem_cgroup_do_charge(struct mem_cgroup *mem, gfp_t gfp_mask,
> flags |= MEM_CGROUP_RECLAIM_NOSWAP;
> } else
> mem_over_limit = mem_cgroup_from_res_counter(fail_res, res);
> -
> - if (csize > PAGE_SIZE) /* change csize and retry */
> + /*
> + * csize can be either a huge page (HPAGE_SIZE), a batch of
> + * regular pages (CHARGE_SIZE), or a single regular page
> + * (PAGE_SIZE).
> + *
> + * Never reclaim on behalf of optional batching, retry with a
> + * single page instead.
> + */
> + if (csize == CHARGE_SIZE)
> return CHARGE_RETRY;
>
> if (!(gfp_mask & __GFP_WAIT))
> --
> 1.7.3.5
>
>
--
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 policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2011-01-31 23:54 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-31 14:03 Johannes Weiner
2011-01-31 14:03 ` [patch 1/3] memcg: prevent endless loop when charging huge pages Johannes Weiner
2011-01-31 22:27 ` Minchan Kim
2011-01-31 23:48 ` KAMEZAWA Hiroyuki [this message]
2011-01-31 14:03 ` [patch 2/3] memcg: prevent endless loop when charging huge pages to near-limit group Johannes Weiner
2011-01-31 22:41 ` Andrew Morton
2011-01-31 23:50 ` KAMEZAWA Hiroyuki
2011-02-01 0:04 ` Johannes Weiner
2011-02-01 0:24 ` Andrew Morton
2011-02-01 0:34 ` Johannes Weiner
2011-02-03 12:53 ` [patch 0/2] memcg: clean up limit checking Johannes Weiner
2011-02-03 12:54 ` [patch 1/2] memcg: soft limit reclaim should end at limit not below Johannes Weiner
2011-02-03 23:41 ` KAMEZAWA Hiroyuki
2011-02-04 4:10 ` Balbir Singh
2011-02-03 12:56 ` [patch 2/2] memcg: simplify the way memory limits are checked Johannes Weiner
2011-02-03 23:44 ` KAMEZAWA Hiroyuki
2011-02-04 4:12 ` Balbir Singh
2011-01-31 22:42 ` [patch 2/3] memcg: prevent endless loop when charging huge pages to near-limit group Minchan Kim
2011-01-31 14:03 ` [patch 3/3] memcg: never OOM when charging huge pages Johannes Weiner
2011-01-31 22:52 ` Minchan Kim
2011-01-31 23:51 ` 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=20110201084829.86b7290c.kamezawa.hiroyu@jp.fujitsu.com \
--to=kamezawa.hiroyu@jp.fujitsu.com \
--cc=akpm@linux-foundation.org \
--cc=balbir@linux.vnet.ibm.com \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=minchan.kim@gmail.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