linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@suse.cz>
To: Hugh Dickins <hughd@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Wen Congyang <wency@cn.fujitsu.com>,
	linux-kernel@vger.kernel.org, cgroups@vger.kernel.org,
	linux-mm@kvack.org, Jiang Liu <liuj97@gmail.com>,
	bsingharora@gmail.com,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Konstantin Khlebnikov <khlebnikov@openvz.org>,
	paul.gortmaker@windriver.com, Tang Chen <tangchen@cn.fujitsu.com>
Subject: Re: [PATCH] memcg: fix hotplugged memory zone oops
Date: Fri, 2 Nov 2012 11:54:20 +0100	[thread overview]
Message-ID: <20121102105420.GB24073@dhcp22.suse.cz> (raw)
In-Reply-To: <20121102102159.GA24073@dhcp22.suse.cz>

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 <hughd@google.com>
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 <tangchen@cn.fujitsu.com>
Signed-off-by: Hugh Dickins <hughd@google.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: Michal Hocko <mhocko@suse.cz>
Cc: Konstantin Khlebnikov <khlebnikov@openvz.org>
Cc: Wen Congyang <wency@cn.fujitsu.com>
---
 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

  reply	other threads:[~2012-11-02 10:54 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-13  7:14 [PATCH] memory cgroup: update root memory cgroup when node is onlined Wen Congyang
2012-09-13 10:06 ` Kamezawa Hiroyuki
2012-09-13 10:18   ` Wen Congyang
2012-09-13 20:59 ` Johannes Weiner
2012-09-14  1:36   ` Hugh Dickins
2012-09-14  1:53     ` Wen Congyang
2012-09-14 15:46     ` Johannes Weiner
2012-09-15 10:56     ` Konstantin Khlebnikov
2012-09-17  5:50     ` Wen Congyang
2012-10-16  5:58     ` Wen Congyang
2012-10-18 19:03       ` Hugh Dickins
2012-10-18 22:03         ` Johannes Weiner
2012-11-02  1:28           ` [PATCH] memcg: fix hotplugged memory zone oops Hugh Dickins
2012-11-02 10:21             ` Michal Hocko
2012-11-02 10:54               ` Michal Hocko [this message]
2012-11-02 23:37                 ` Hugh Dickins
2012-11-03  7:00                   ` Michal Hocko
2012-11-02 23:31               ` Hugh Dickins
2012-10-16  7:21     ` [PATCH] memory cgroup: update root memory cgroup when node is onlined Kamezawa Hiroyuki
2012-09-14  1:46   ` Wen Congyang
2012-09-17  6:40     ` Hugh Dickins

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=20121102105420.GB24073@dhcp22.suse.cz \
    --to=mhocko@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=bsingharora@gmail.com \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=khlebnikov@openvz.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=liuj97@gmail.com \
    --cc=paul.gortmaker@windriver.com \
    --cc=tangchen@cn.fujitsu.com \
    --cc=wency@cn.fujitsu.com \
    /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;
as well as URLs for NNTP newsgroup(s).