From: Michal Hocko <mhocko@suse.cz>
To: Zhouping Liu <zliu@redhat.com>
Cc: Kamezawa Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
David Rientjes <rientjes@google.com>,
linux-mm@kvack.org, Li Zefan <lizefan@huawei.com>,
CAI Qian <caiqian@redhat.com>,
LKML <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Tejun Heo <tj@kernel.org>
Subject: Re: memcg: cat: memory.memsw.* : Operation not supported
Date: Mon, 21 Jan 2013 12:12:06 +0100 [thread overview]
Message-ID: <20130121111206.GG7798@dhcp22.suse.cz> (raw)
In-Reply-To: <20130121105624.GF7798@dhcp22.suse.cz>
And we can put another clean up patch on top of the fix:
---
>From a81d36002e7dbd976b617d5eadf32265f36038a4 Mon Sep 17 00:00:00 2001
From: Michal Hocko <mhocko@suse.cz>
Date: Mon, 21 Jan 2013 12:05:29 +0100
Subject: [PATCH] memcg: clean up swap accounting initialization code
Memcg swap accounting is currently enabled by enable_swap_cgroup when
the root cgroup is created. mem_cgroup_init acts as a memcg subsystem
initializer which sounds like a much better place for enable_swap_cgroup
as well. We already register memsw files from there so it makes a lot of
sense to merge those two into a single enable_swap_cgroup function.
This patch doesn't introduce any semantical changes.
Signed-off-by: Michal Hocko <mhocko@suse.cz>
---
mm/memcontrol.c | 30 ++++++++++++------------------
1 file changed, 12 insertions(+), 18 deletions(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index a2800db..878d62c 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -6221,18 +6221,6 @@ struct mem_cgroup *parent_mem_cgroup(struct mem_cgroup *memcg)
}
EXPORT_SYMBOL(parent_mem_cgroup);
-#ifdef CONFIG_MEMCG_SWAP
-static void __init enable_swap_cgroup(void)
-{
- if (!mem_cgroup_disabled() && really_do_swap_account)
- do_swap_account = 1;
-}
-#else
-static void __init enable_swap_cgroup(void)
-{
-}
-#endif
-
static int mem_cgroup_soft_limit_tree_init(void)
{
struct mem_cgroup_tree_per_node *rtpn;
@@ -6286,7 +6274,6 @@ mem_cgroup_css_alloc(struct cgroup *cont)
/* root ? */
if (cont->parent == NULL) {
int cpu;
- enable_swap_cgroup();
parent = NULL;
if (mem_cgroup_soft_limit_tree_init())
goto free_out;
@@ -6976,12 +6963,19 @@ __setup("swapaccount=", enable_swap_account);
static void __init memsw_file_init(void)
{
- if (really_do_swap_account)
- WARN_ON(cgroup_add_cftypes(&mem_cgroup_subsys,
- memsw_cgroup_files));
+ WARN_ON(cgroup_add_cftypes(&mem_cgroup_subsys, memsw_cgroup_files));
+}
+
+static void __init enable_swap_cgroup(void)
+{
+ if (!mem_cgroup_disabled() && really_do_swap_account) {
+ do_swap_account = 1;
+ memsw_file_init();
+ }
}
+
#else
-static void __init memsw_file_init(void)
+static void __init enable_swap_cgroup(void)
{
}
#endif
@@ -6995,7 +6989,7 @@ static void __init memsw_file_init(void)
static int __init mem_cgroup_init(void)
{
hotcpu_notifier(memcg_cpu_hotplug_callback, 0);
- memsw_file_init();
+ enable_swap_cgroup();
return 0;
}
subsys_initcall(mem_cgroup_init);
--
1.7.10.4
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2013-01-21 11:12 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <2a1a74bf-fbb5-4a6e-b958-44fff8debff2@zmail13.collab.prod.int.phx2.redhat.com>
2012-06-27 3:49 ` Zhouping Liu
2012-06-27 15:48 ` Michal Hocko
2012-06-27 20:04 ` David Rientjes
2012-06-27 20:09 ` Tejun Heo
2012-06-27 20:21 ` David Rientjes
2012-06-27 20:24 ` Tejun Heo
2012-06-27 20:26 ` David Rientjes
2012-06-28 4:04 ` Kamezawa Hiroyuki
2012-06-28 18:31 ` Tejun Heo
2012-06-30 3:45 ` Kamezawa Hiroyuki
2013-01-21 8:39 ` Zhouping Liu
2013-01-21 10:56 ` Michal Hocko
2013-01-21 11:12 ` Michal Hocko [this message]
2013-01-21 13:27 ` Zhouping Liu
2013-01-21 13:46 ` Michal Hocko
2012-06-29 7:16 ` Glauber Costa
2012-06-28 12:36 ` Michal Hocko
2012-06-28 18:29 ` Tejun Heo
2012-06-29 0:11 ` Kamezawa Hiroyuki
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=20130121111206.GG7798@dhcp22.suse.cz \
--to=mhocko@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=caiqian@redhat.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lizefan@huawei.com \
--cc=rientjes@google.com \
--cc=tj@kernel.org \
--cc=zliu@redhat.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
Powered by JetHome