From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757233Ab2ARJZ1 (ORCPT ); Wed, 18 Jan 2012 04:25:27 -0500 Received: from zene.cmpxchg.org ([85.214.230.12]:41613 "EHLO zene.cmpxchg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757028Ab2ARJZX (ORCPT ); Wed, 18 Jan 2012 04:25:23 -0500 Date: Wed, 18 Jan 2012 10:25:09 +0100 From: Johannes Weiner To: Sha Cc: Ying Han , Andrew Morton , Michal Hocko , KAMEZAWA Hiroyuki , Balbir Singh , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [patch 2/2] mm: memcg: hierarchical soft limit reclaim Message-ID: <20120118092509.GI24386@cmpxchg.org> References: <1326207772-16762-1-git-send-email-hannes@cmpxchg.org> <1326207772-16762-3-git-send-email-hannes@cmpxchg.org> <20120112085904.GG24386@cmpxchg.org> <20120113224424.GC1653@cmpxchg.org> <4F158418.2090509@gmail.com> <20120117145348.GA3144@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 18, 2012 at 03:17:25PM +0800, Sha wrote: > > > I don't think it solve the root of the problem, example: > > > root > > > -> A (hard limit 20G, soft limit 12G, usage 20G) > > > -> A1 ( soft limit 2G, usage 1G) > > > -> A2 ( soft limit 10G, usage 19G) > > > ->B1 (soft limit 5G, usage 4G) > > > ->B2 (soft limit 5G, usage 15G) > > > > > > Now A is hitting its hard limit and start hierarchical reclaim under A. > > > If we choose B1 to go through mem_cgroup_over_soft_limit, it will > > > return true because its parent A2 has a large usage and will lead to > > > priority=0 reclaiming. But in fact it should be B2 to be punished. > > > Because A2 is over its soft limit, the whole hierarchy below it should > > be preferred over A1, so both B1 and B2 should be soft limit reclaimed > > to be consistent with behaviour at the root level. > > Well it is just the behavior that I'm expecting actually. But with my > humble comprehension, I can't catch the soft-limit-based hierarchical > reclaiming under the target cgroup (A2) in the current implementation > or after the patch. Both the current mem_cgroup_soft_reclaim or > shrink_zone select victim sub-cgroup by mem_cgroup_iter, but it > doesn't take soft limit into consideration, do I left anything ? No, currently soft limits are ignored if pressure originates from below root_mem_cgroup. But iff soft limits are applied right now, they are applied hierarchically, see mem_cgroup_soft_limit_reclaim(). In my opinion, the fact that soft limits are ignored when pressure is triggered sub-root_mem_cgroup is an artifact of the per-zone tree, so I allowed soft limits to be taken into account below root_mem_cgroup. But IMO, this is something different from how soft limit reclaim is applied once triggered: currently, soft limit reclaim applies to a whole hierarchy, including all children. And this I left unchanged.