Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 83789
b: refs/heads/master
c: d2ceb9b
h: refs/heads/master
i:
  83787: 25a8ed6
v: v3
  • Loading branch information
KAMEZAWA Hiroyuki authored and Linus Torvalds committed Feb 7, 2008
1 parent deca390 commit ac50f14
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d52aa412d43827033a8e2ce4415ef6e8f8d53635
refs/heads/master: d2ceb9b7ddedbb2e8e590bc6ce33c854043016f9
48 changes: 48 additions & 0 deletions trunk/mm/memcontrol.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <linux/swap.h>
#include <linux/spinlock.h>
#include <linux/fs.h>
#include <linux/seq_file.h>

#include <asm/uaccess.h>

Expand Down Expand Up @@ -794,6 +795,49 @@ static ssize_t mem_force_empty_read(struct cgroup *cont,
}


static const struct mem_cgroup_stat_desc {
const char *msg;
u64 unit;
} mem_cgroup_stat_desc[] = {
[MEM_CGROUP_STAT_CACHE] = { "cache", PAGE_SIZE, },
[MEM_CGROUP_STAT_RSS] = { "rss", PAGE_SIZE, },
};

static int mem_control_stat_show(struct seq_file *m, void *arg)
{
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;

for (i = 0; i < ARRAY_SIZE(stat->cpustat[0].count); i++) {
s64 val;

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);
}
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",
Expand Down Expand Up @@ -821,6 +865,10 @@ static struct cftype mem_cgroup_files[] = {
.write = mem_force_empty_write,
.read = mem_force_empty_read,
},
{
.name = "stat",
.open = mem_control_stat_open,
},
};

static struct mem_cgroup init_mem_cgroup;
Expand Down

0 comments on commit ac50f14

Please sign in to comment.