[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140603132255.GJ1321@dhcp22.suse.cz>
Date: Tue, 3 Jun 2014 15:22:55 +0200
From: Michal Hocko <mhocko@...e.cz>
To: Johannes Weiner <hannes@...xchg.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Hugh Dickins <hughd@...gle.com>, Tejun Heo <tj@...nel.org>,
Vladimir Davydov <vdavydov@...allels.com>,
cgroups@...r.kernel.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [patch 05/10] mm: memcontrol: catch root bypass in move precharge
On Thu 29-05-14 12:15:57, Johannes Weiner wrote:
> When mem_cgroup_try_charge() returns -EINTR, it bypassed the charge to
> the root memcg. But move precharging does not catch this and treats
> this case as if no charge had happened, thus leaking a charge against
> root. Because of an old optimization, the root memcg's res_counter is
> not actually charged right now, but it's still an imbalance and
> subsequent patches will charge the root memcg again.
>
> Catch those bypasses to the root memcg and properly cancel them before
> giving up the move.
>
> Signed-off-by: Johannes Weiner <hannes@...xchg.org>
Acked-by: Michal Hocko <mhocko@...e.cz>
> ---
> mm/memcontrol.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 8957d6c945b8..184e67cce4e4 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -6485,8 +6485,15 @@ one_by_one:
> cond_resched();
> }
> ret = mem_cgroup_try_charge(memcg, GFP_KERNEL, 1, false);
> + /*
> + * In case of failure, any residual charges against
> + * mc.to will be dropped by mem_cgroup_clear_mc()
> + * later on. However, cancel any charges that are
> + * bypassed to root right away or they'll be lost.
> + */
> + if (ret == -EINTR)
> + __mem_cgroup_cancel_charge(root_mem_cgroup, 1);
> if (ret)
> - /* mem_cgroup_clear_mc() will do uncharge later */
> return ret;
> mc.precharge++;
> }
> --
> 1.9.3
>
--
Michal Hocko
SUSE Labs
--
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