From: menage@google.com
To: akpm@linux-foundation.org, balbir@in.ibm.com, pj@sgi.com,
Pavel Emelianov <xemul@openvz.org>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Cc: linux-kernel@vger.kernel.org, containers@lists.linux-foundation.org
Subject: [PATCH 07/10] CGroup API files: Use cgroup map for memcontrol stats file
Date: Sat, 23 Feb 2008 14:47:32 -0800 [thread overview]
Message-ID: <20080223232618.282132000@menage.corp.google.com> (raw)
In-Reply-To: 20080223224725.115590000@menage.corp.google.com
[-- Attachment #1: memcontrol_use_cgroup_map.patch --]
[-- Type: text/plain, Size: 2373 bytes --]
Remove the seq_file boilerplate used to construct the memcontrol stats
map, and instead use the new map representation for cgroup control
files
Signed-off-by: Paul Menage <menage@google.com>
---
mm/memcontrol.c | 30 ++++++------------------------
1 file changed, 6 insertions(+), 24 deletions(-)
Index: cgroup-2.6.25-rc2-mm1/mm/memcontrol.c
===================================================================
--- cgroup-2.6.25-rc2-mm1.orig/mm/memcontrol.c
+++ cgroup-2.6.25-rc2-mm1/mm/memcontrol.c
@@ -971,9 +971,9 @@ static const struct mem_cgroup_stat_desc
[MEM_CGROUP_STAT_RSS] = { "rss", PAGE_SIZE, },
};
-static int mem_control_stat_show(struct seq_file *m, void *arg)
+static int mem_control_stat_show(struct cgroup *cont, struct cftype *cft,
+ struct cgroup_map_cb *cb)
{
- struct cgroup *cont = m->private;
struct mem_cgroup *mem_cont = mem_cgroup_from_cont(cont);
struct mem_cgroup_stat *stat = &mem_cont->stat;
int i;
@@ -983,8 +983,7 @@ static int mem_control_stat_show(struct
val = mem_cgroup_read_stat(stat, i);
val *= mem_cgroup_stat_desc[i].unit;
- seq_printf(m, "%s %lld\n", mem_cgroup_stat_desc[i].msg,
- (long long)val);
+ cb->fill(cb, mem_cgroup_stat_desc[i].msg, val);
}
/* showing # of active pages */
{
@@ -994,29 +993,12 @@ static int mem_control_stat_show(struct
MEM_CGROUP_ZSTAT_INACTIVE);
active = mem_cgroup_get_all_zonestat(mem_cont,
MEM_CGROUP_ZSTAT_ACTIVE);
- seq_printf(m, "active %ld\n", (active) * PAGE_SIZE);
- seq_printf(m, "inactive %ld\n", (inactive) * PAGE_SIZE);
+ cb->fill(cb, "active", (active) * PAGE_SIZE);
+ cb->fill(cb, "inactive", (inactive) * PAGE_SIZE);
}
return 0;
}
-static const struct file_operations mem_control_stat_file_operations = {
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
-};
-
-static int mem_control_stat_open(struct inode *unused, struct file *file)
-{
- /* XXX __d_cont */
- struct cgroup *cont = file->f_dentry->d_parent->d_fsdata;
-
- file->f_op = &mem_control_stat_file_operations;
- return single_open(file, mem_control_stat_show, cont);
-}
-
-
-
static struct cftype mem_cgroup_files[] = {
{
.name = "usage_in_bytes",
@@ -1041,7 +1023,7 @@ static struct cftype mem_cgroup_files[]
},
{
.name = "stat",
- .open = mem_control_stat_open,
+ .read_map = mem_control_stat_show,
},
};
--
next prev parent reply other threads:[~2008-02-23 23:30 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-23 22:47 [PATCH 00/10] CGroup API files: Various cleanup to CGroup control files menage
2008-02-23 22:47 ` [PATCH 01/10] CGroup API files: Rename read/write_uint methods to read_write_u64 menage-hpIqsD4AKlfQT0dZR+AlfA
2008-02-23 22:47 ` menage
2008-02-23 22:47 ` [PATCH 02/10] CGroup API files: Add res_counter_read_u64() menage-hpIqsD4AKlfQT0dZR+AlfA
2008-02-23 22:47 ` menage
2008-02-23 22:47 ` [PATCH 03/10] CGroup API files: Use read_u64 in memory controller menage-hpIqsD4AKlfQT0dZR+AlfA
2008-02-23 22:47 ` menage
2008-02-23 22:47 ` [PATCH 04/10] CGroup API files: Strip all trailing whitespace in cgroup_write_u64 menage
2008-02-23 22:47 ` menage-hpIqsD4AKlfQT0dZR+AlfA
2008-02-23 22:47 ` [PATCH 05/10] CGroup API files: Update cpusets to use cgroup structured file API menage-hpIqsD4AKlfQT0dZR+AlfA
2008-02-23 22:47 ` menage
[not found] ` <20080223232617.958345000-B63HFAS8fGlSzHKm+aFRNNkmqwFzkYv6@public.gmane.org>
2008-02-27 0:54 ` Li Zefan
2008-02-27 0:54 ` Li Zefan
2008-02-27 1:09 ` Paul Menage
[not found] ` <47C4B4B0.4010700-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2008-02-27 1:09 ` Paul Menage
2008-02-23 22:47 ` [PATCH 06/10] CGroup API files: Add cgroup map data type menage-hpIqsD4AKlfQT0dZR+AlfA
2008-02-23 22:47 ` menage
2008-02-23 22:47 ` menage [this message]
2008-02-23 22:47 ` [PATCH 07/10] CGroup API files: Use cgroup map for memcontrol stats file menage-hpIqsD4AKlfQT0dZR+AlfA
2008-02-23 22:47 ` [PATCH 08/10] CGroup API files: Drop mem_cgroup_force_empty() menage-hpIqsD4AKlfQT0dZR+AlfA
2008-02-23 22:47 ` menage
2008-02-23 22:47 ` [PATCH 09/10] CGroup API files: Move "releasable" to cgroup_debug subsystem menage-hpIqsD4AKlfQT0dZR+AlfA
2008-02-23 22:47 ` menage
2008-02-23 22:47 ` [PATCH 10/10] CGroup API files: Make CGROUP_DEBUG default to off menage-hpIqsD4AKlfQT0dZR+AlfA
2008-02-23 22:47 ` menage
[not found] ` <20080223224725.115590000-B63HFAS8fGlSzHKm+aFRNNkmqwFzkYv6@public.gmane.org>
2008-02-26 3:23 ` [PATCH 00/10] CGroup API files: Various cleanup to CGroup control files Li Zefan
2008-02-26 3:23 ` Li Zefan
2008-02-26 6:19 ` Paul Menage
[not found] ` <6599ad830802252219p77f41917u7c6c137c8e5448e0-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-02-26 7:48 ` Li Zefan
2008-02-26 7:48 ` Li Zefan
[not found] ` <47C3C462.4000706-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2008-02-27 1:09 ` Paul Menage
2008-02-27 1:09 ` Paul Menage
[not found] ` <47C3862D.8080603-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2008-02-26 6:19 ` Paul Menage
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=20080223232618.282132000@menage.corp.google.com \
--to=menage@google.com \
--cc=akpm@linux-foundation.org \
--cc=balbir@in.ibm.com \
--cc=containers@lists.linux-foundation.org \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pj@sgi.com \
--cc=xemul@openvz.org \
--cc=yamamoto@valinux.co.jp \
/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.