From: Wanpeng Li <liwp.linux@gmail.com>
To: linux-mm@kvack.org
Cc: Johannes Weiner <hannes@cmpxchg.org>,
Michal Hocko <mhocko@suse.cz>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
Andrew Morton <akpm@linux-foundation.org>,
cgroups@vger.kernel.org, linux-kernel@vger.kernel.org,
Wanpeng Li <liwp.linux@gmail.com>
Subject: [PATCH RFC] mm/memcg: recalculate chargeable space after waiting migrating charges
Date: Thu, 12 Jul 2012 18:39:21 +0800 [thread overview]
Message-ID: <1342089561-11211-1-git-send-email-liwp.linux@gmail.com> (raw)
From: Wanpeng Li <liwp@linux.vnet.ibm.com>
Function mem_cgroup_do_charge will call mem_cgroup_reclaim,
there are two break points in mem_cgroup_reclaim:
if (total && (flag & MEM_CGROUP_RECLAIM_SHIRINK))
break;
if (mem_cgroup_margin(memcg))
break;
so mem_cgroup_reclaim can't guarantee reclaim enough pages(nr_pages)
which is requested from mem_cgroup_do_charge, if mem_cgroup_margin
(mem_over_limit) >= nr_pages is not true, the process will go to
mem_cgroup_wait_acct_move to wait doubly charge counted caused by
task move. But this time still can't guarantee enough pages(nr_pages) is
ready, directly return CHARGE_RETRY is incorret. We should add a check
to confirm enough pages is ready, otherwise go to oom.
Signed-off-by: Wanpeng Li <liwp.linux@gmail.com>
---
mm/memcontrol.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index f72b5e5..4ae3848 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2210,7 +2210,8 @@ static int mem_cgroup_do_charge(struct mem_cgroup *memcg, gfp_t gfp_mask,
* At task move, charge accounts can be doubly counted. So, it's
* better to wait until the end of task_move if something is going on.
*/
- if (mem_cgroup_wait_acct_move(mem_over_limit))
+ if (mem_cgroup_wait_acct_move(mem_over_limit)
+ && mem_cgroup_margin(mem_over_limit) >= nr_pages)
return CHARGE_RETRY;
/* If we don't need to call oom-killer at el, return immediately */
--
1.7.5.4
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: Wanpeng Li <liwp.linux@gmail.com>
To: linux-mm@kvack.org
Cc: Johannes Weiner <hannes@cmpxchg.org>,
Michal Hocko <mhocko@suse.cz>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
Andrew Morton <akpm@linux-foundation.org>,
cgroups@vger.kernel.org, linux-kernel@vger.kernel.org,
Wanpeng Li <liwp.linux@gmail.com>
Subject: [PATCH RFC] mm/memcg: recalculate chargeable space after waiting migrating charges
Date: Thu, 12 Jul 2012 18:39:21 +0800 [thread overview]
Message-ID: <1342089561-11211-1-git-send-email-liwp.linux@gmail.com> (raw)
From: Wanpeng Li <liwp@linux.vnet.ibm.com>
Function mem_cgroup_do_charge will call mem_cgroup_reclaim,
there are two break points in mem_cgroup_reclaim:
if (total && (flag & MEM_CGROUP_RECLAIM_SHIRINK))
break;
if (mem_cgroup_margin(memcg))
break;
so mem_cgroup_reclaim can't guarantee reclaim enough pages(nr_pages)
which is requested from mem_cgroup_do_charge, if mem_cgroup_margin
(mem_over_limit) >= nr_pages is not true, the process will go to
mem_cgroup_wait_acct_move to wait doubly charge counted caused by
task move. But this time still can't guarantee enough pages(nr_pages) is
ready, directly return CHARGE_RETRY is incorret. We should add a check
to confirm enough pages is ready, otherwise go to oom.
Signed-off-by: Wanpeng Li <liwp.linux@gmail.com>
---
mm/memcontrol.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index f72b5e5..4ae3848 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2210,7 +2210,8 @@ static int mem_cgroup_do_charge(struct mem_cgroup *memcg, gfp_t gfp_mask,
* At task move, charge accounts can be doubly counted. So, it's
* better to wait until the end of task_move if something is going on.
*/
- if (mem_cgroup_wait_acct_move(mem_over_limit))
+ if (mem_cgroup_wait_acct_move(mem_over_limit)
+ && mem_cgroup_margin(mem_over_limit) >= nr_pages)
return CHARGE_RETRY;
/* If we don't need to call oom-killer at el, return immediately */
--
1.7.5.4
next reply other threads:[~2012-07-12 10:39 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-12 10:39 Wanpeng Li [this message]
2012-07-12 10:39 ` [PATCH RFC] mm/memcg: recalculate chargeable space after waiting migrating charges Wanpeng Li
[not found] ` <1342089561-11211-1-git-send-email-liwp.linux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-07-12 11:08 ` Michal Hocko
2012-07-12 11:08 ` Michal Hocko
2012-07-12 11:08 ` Michal Hocko
2012-07-12 11:51 ` Wanpeng Li
2012-07-12 11:51 ` Wanpeng Li
2012-07-12 12:29 ` Michal Hocko
2012-07-12 12:29 ` Michal Hocko
2012-07-12 12:29 ` Michal Hocko
[not found] ` <20120712122912.GH21013-VqjxzfR4DlwKmadIfiO5sKVXKuFTiq87@public.gmane.org>
2012-07-12 13:38 ` Wanpeng Li
2012-07-12 13:38 ` Wanpeng Li
2012-07-12 13:38 ` Wanpeng Li
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=1342089561-11211-1-git-send-email-liwp.linux@gmail.com \
--to=liwp.linux@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.cz \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.