From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762472Ab2KBKyY (ORCPT ); Fri, 2 Nov 2012 06:54:24 -0400 Received: from cantor2.suse.de ([195.135.220.15]:50792 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1762210Ab2KBKyW (ORCPT ); Fri, 2 Nov 2012 06:54:22 -0400 Date: Fri, 2 Nov 2012 11:54:20 +0100 From: Michal Hocko To: Hugh Dickins Cc: Andrew Morton , Johannes Weiner , Wen Congyang , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org, Jiang Liu , bsingharora@gmail.com, KAMEZAWA Hiroyuki , Konstantin Khlebnikov , paul.gortmaker@windriver.com, Tang Chen Subject: Re: [PATCH] memcg: fix hotplugged memory zone oops Message-ID: <20121102105420.GB24073@dhcp22.suse.cz> References: <505187D4.7070404@cn.fujitsu.com> <20120913205935.GK1560@cmpxchg.org> <507CF789.6050307@cn.fujitsu.com> <20121018220306.GA1739@cmpxchg.org> <20121102102159.GA24073@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20121102102159.GA24073@dhcp22.suse.cz> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 02-11-12 11:21:59, Michal Hocko wrote: > On Thu 01-11-12 18:28:02, Hugh Dickins wrote: [...] And I forgot to mention that the following hunk will clash with "memcg: Simplify mem_cgroup_force_empty_list error handling" which is in linux-next already (via Tejun's tree). Would it be easier to split the patch into the real fix and the hunk bellow? That one doesn't have to go into stable anyway and we would save some merging conflicts. The updated fix on top of -mm tree is bellow for your convinience. > > /** > > @@ -3688,17 +3712,17 @@ unsigned long mem_cgroup_soft_limit_recl > > static bool mem_cgroup_force_empty_list(struct mem_cgroup *memcg, > > int node, int zid, enum lru_list lru) > > { > > - struct mem_cgroup_per_zone *mz; > > + struct lruvec *lruvec; > > unsigned long flags, loop; > > struct list_head *list; > > struct page *busy; > > struct zone *zone; > > > > zone = &NODE_DATA(node)->node_zones[zid]; > > - mz = mem_cgroup_zoneinfo(memcg, node, zid); > > - list = &mz->lruvec.lists[lru]; > > + lruvec = mem_cgroup_zone_lruvec(zone, memcg); > > + list = &lruvec->lists[lru]; > > > > - loop = mz->lru_size[lru]; > > + loop = mem_cgroup_get_lru_size(lruvec, lru); > > /* give some margin against EBUSY etc...*/ > > loop += 256; > > busy = NULL; --- >>From 0e55c305a050502a4b2f5167efed58bb6585520b Mon Sep 17 00:00:00 2001 From: Hugh Dickins Date: Fri, 2 Nov 2012 11:47:48 +0100 Subject: [PATCH] memcg: use mem_cgroup_zone_lruvec in mem_cgroup_force_empty_list For no particularly good reason, mem_cgroup_force_empty_list() has its own code for deciding lruvec. Change it to use the standard mem_cgroup_zone_lruvec() and mem_cgroup_get_lru_size() too. In fact it was already safe against oops after memory hotadd (see "memcg: fix hotplugged memory zone oops" for more details) when lruvec is not initialized yet (the lru lists in danger could only be empty), but we're better proofed against future changes this way. Reported-by: Tang Chen Signed-off-by: Hugh Dickins Acked-by: Johannes Weiner Acked-by: KAMEZAWA Hiroyuki Acked-by: Michal Hocko Cc: Konstantin Khlebnikov Cc: Wen Congyang --- mm/memcontrol.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 6c72d65..32f0ecf 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -3710,15 +3710,15 @@ unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order, static void mem_cgroup_force_empty_list(struct mem_cgroup *memcg, int node, int zid, enum lru_list lru) { - struct mem_cgroup_per_zone *mz; + struct lruvec *lruvec; unsigned long flags; struct list_head *list; struct page *busy; struct zone *zone; zone = &NODE_DATA(node)->node_zones[zid]; - mz = mem_cgroup_zoneinfo(memcg, node, zid); - list = &mz->lruvec.lists[lru]; + lruvec = mem_cgroup_zone_lruvec(zone, memcg); + list = &lruvec->lists[lru]; busy = NULL; do { -- 1.7.10.4 -- Michal Hocko SUSE Labs