[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110127140024.GR14750@redhat.com>
Date: Thu, 27 Jan 2011 16:00:24 +0200
From: Gleb Natapov <gleb@...hat.com>
To: Johannes Weiner <hannes@...xchg.org>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"nishimura@....nes.nec.co.jp" <nishimura@....nes.nec.co.jp>,
"balbir@...ux.vnet.ibm.com" <balbir@...ux.vnet.ibm.com>,
"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>
Subject: Re: [patch 2/3] memcg: prevent endless loop on huge page charge
On Thu, Jan 27, 2011 at 02:46:45PM +0100, Johannes Weiner 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.
>
Yeah, that is exactly the case I am debugging right now. Came up with
different solution: pass page_size to __mem_cgroup_do_charge() and
compare csize with page_size (not CHARGE_SIZE). Not sure which solution
it more correct.
> Signed-off-by: Johannes Weiner <hannes@...xchg.org>
> ---
> mm/memcontrol.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 8fa4be3..17c4e36 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -1847,7 +1847,7 @@ static int __mem_cgroup_do_charge(struct mem_cgroup *mem, gfp_t gfp_mask,
> } else
> mem_over_limit = mem_cgroup_from_res_counter(fail_res, res);
>
> - if (csize > PAGE_SIZE) /* change csize and retry */
> + if (csize == CHARGE_SIZE) /* retry without batching */
> 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@...ck.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@...ck.org"> email@...ck.org </a>
--
Gleb.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists