* [PATCH] memcg: support hierarchical memory.numa_stats
@ 2013-04-08 21:58 Ying Han
2013-04-17 1:32 ` Michal Hocko
2013-04-24 9:02 ` [PATCH 1/2] memcg: refactor mem_control_numa_stat_show() Greg Thelen
0 siblings, 2 replies; 5+ messages in thread
From: Ying Han @ 2013-04-08 21:58 UTC (permalink / raw)
To: Michal Hocko, Johannes Weiner, KAMEZAWA Hiroyuki, Rik van Riel,
Hillf Danton, Hugh Dickins
Cc: linux-mm
The memory.numa_stat is not currently hierarchical. Memory charged to the
children are not shown in parent's numa_stat.
This change adds the "hierarchical_" stats on top of all existing stats, and
it includes the sum of all children's values in addition to the value of
the memcg.
Tested: Create cgroup a, a/b and run workload under b. The values of b are
included in the "hierarchical_*" under a.
$ cat /dev/cgroup/memory/a/memory.numa_stat
total=0 N0=0 N1=0
file=0 N0=0 N1=0
anon=0 N0=0 N1=0
unevictable=0 N0=0 N1=0
hierarchical_total=262474 N0=262162 N1=312
hierarchical_file=247 N0=0 N1=247
hierarchical_anon=262227 N0=262162 N1=65
hierarchical_unevictable=0 N0=0 N1=0
$ cat /dev/cgroup/memory/a/b/memory.numa_stat
total=262474 N0=262162 N1=312
file=247 N0=0 N1=247
anon=262227 N0=262162 N1=65
unevictable=0 N0=0 N1=0
hierarchical_total=262474 N0=262162 N1=312
hierarchical_file=247 N0=0 N1=247
hierarchical_anon=262227 N0=262162 N1=65
hierarchical_unevictable=0 N0=0 N1=0
Signed-off-by: Ying Han <yinghan@google.com>
---
Documentation/cgroups/memory.txt | 5 +++-
mm/memcontrol.c | 65 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 69 insertions(+), 1 deletion(-)
diff --git a/Documentation/cgroups/memory.txt b/Documentation/cgroups/memory.txt
index 8b8c28b..b519e74 100644
--- a/Documentation/cgroups/memory.txt
+++ b/Documentation/cgroups/memory.txt
@@ -568,7 +568,10 @@ node. One of the use cases is evaluating application performance by
combining this information with the application's CPU allocation.
We export "total", "file", "anon" and "unevictable" pages per-node for
-each memcg. The ouput format of memory.numa_stat is:
+each memcg and "hierarchical_" for sum of all hierarchical children's values
+in addition to the memcg's own value.
+
+The ouput format of memory.numa_stat is:
total=<total pages> N0=<node 0 pages> N1=<node 1 pages> ...
file=<total file pages> N0=<node 0 pages> N1=<node 1 pages> ...
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 2b55222..9d8cf25 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1177,6 +1177,32 @@ void mem_cgroup_iter_break(struct mem_cgroup *root,
iter != NULL; \
iter = mem_cgroup_iter(NULL, iter, NULL))
+static unsigned long
+mem_cgroup_node_hierarchical_nr_lru_pages(struct mem_cgroup *memcg,
+ int nid, unsigned int lru_mask)
+{
+ u64 total = 0;
+ struct mem_cgroup *iter;
+
+ for_each_mem_cgroup_tree(iter, memcg)
+ total += mem_cgroup_node_nr_lru_pages(iter, nid, lru_mask);
+
+ return total;
+}
+
+static unsigned long
+mem_cgroup_hierarchical_nr_lru_pages(struct mem_cgroup *memcg,
+ unsigned int lru_mask)
+{
+ u64 total = 0;
+ struct mem_cgroup *iter;
+
+ for_each_mem_cgroup_tree(iter, memcg)
+ total += mem_cgroup_nr_lru_pages(iter, lru_mask);
+
+ return total;
+}
+
void __mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx)
{
struct mem_cgroup *memcg;
@@ -5267,6 +5293,45 @@ static int memcg_numa_stat_show(struct cgroup *cont, struct cftype *cft,
seq_printf(m, " N%d=%lu", nid, node_nr);
}
seq_putc(m, '\n');
+
+ total_nr = mem_cgroup_hierarchical_nr_lru_pages(memcg, LRU_ALL);
+ seq_printf(m, "hierarchical_total=%lu", total_nr);
+ for_each_node_state(nid, N_HIGH_MEMORY) {
+ node_nr =
+ mem_cgroup_node_hierarchical_nr_lru_pages(memcg, nid,
+ LRU_ALL);
+ seq_printf(m, " N%d=%lu", nid, node_nr);
+ }
+ seq_putc(m, '\n');
+
+ file_nr = mem_cgroup_hierarchical_nr_lru_pages(memcg, LRU_ALL_FILE);
+ seq_printf(m, "hierarchical_file=%lu", file_nr);
+ for_each_node_state(nid, N_HIGH_MEMORY) {
+ node_nr = mem_cgroup_node_hierarchical_nr_lru_pages(memcg, nid,
+ LRU_ALL_FILE);
+ seq_printf(m, " N%d=%lu", nid, node_nr);
+ }
+ seq_putc(m, '\n');
+
+ anon_nr = mem_cgroup_hierarchical_nr_lru_pages(memcg, LRU_ALL_ANON);
+ seq_printf(m, "hierarchical_anon=%lu", anon_nr);
+ for_each_node_state(nid, N_HIGH_MEMORY) {
+ node_nr = mem_cgroup_node_hierarchical_nr_lru_pages(memcg, nid,
+ LRU_ALL_ANON);
+ seq_printf(m, " N%d=%lu", nid, node_nr);
+ }
+ seq_putc(m, '\n');
+
+ unevictable_nr = mem_cgroup_hierarchical_nr_lru_pages(memcg,
+ BIT(LRU_UNEVICTABLE));
+ seq_printf(m, "hierarchical_unevictable=%lu", unevictable_nr);
+ for_each_node_state(nid, N_HIGH_MEMORY) {
+ node_nr = mem_cgroup_node_hierarchical_nr_lru_pages(memcg, nid,
+ BIT(LRU_UNEVICTABLE));
+ seq_printf(m, " N%d=%lu", nid, node_nr);
+ }
+ seq_putc(m, '\n');
+
return 0;
}
#endif /* CONFIG_NUMA */
--
1.8.1.3
--
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>
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] memcg: support hierarchical memory.numa_stats
2013-04-08 21:58 [PATCH] memcg: support hierarchical memory.numa_stats Ying Han
@ 2013-04-17 1:32 ` Michal Hocko
2013-04-24 9:02 ` [PATCH 1/2] memcg: refactor mem_control_numa_stat_show() Greg Thelen
1 sibling, 0 replies; 5+ messages in thread
From: Michal Hocko @ 2013-04-17 1:32 UTC (permalink / raw)
To: Ying Han
Cc: Johannes Weiner, KAMEZAWA Hiroyuki, Rik van Riel, Hillf Danton,
Hugh Dickins, linux-mm
I am sorry but I didn't get to this sooner.
On Mon 08-04-13 14:58:46, Ying Han wrote:
> The memory.numa_stat is not currently hierarchical. Memory charged to the
> children are not shown in parent's numa_stat.
>
> This change adds the "hierarchical_" stats on top of all existing stats, and
> it includes the sum of all children's values in addition to the value of
> the memcg.
OK, I guess it makes some sense to be consistent with what we have in
memory.stat file. We are using total_ prefix there for most things
though (except for the limit which uses hierarchical). I am not sure
total_total sounds that great... So maybe hierarchical_ wouldn't be that
bad in the end.
Few comments bellow but other than that
Acked-by: Michal Hocko <mhocko@suse.cz>
[...]
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -1177,6 +1177,32 @@ void mem_cgroup_iter_break(struct mem_cgroup *root,
> iter != NULL; \
> iter = mem_cgroup_iter(NULL, iter, NULL))
>
> +static unsigned long
> +mem_cgroup_node_hierarchical_nr_lru_pages(struct mem_cgroup *memcg,
> + int nid, unsigned int lru_mask)
> +{
> + u64 total = 0;
> + struct mem_cgroup *iter;
> +
> + for_each_mem_cgroup_tree(iter, memcg)
> + total += mem_cgroup_node_nr_lru_pages(iter, nid, lru_mask);
> +
> + return total;
> +}
> +
> +static unsigned long
> +mem_cgroup_hierarchical_nr_lru_pages(struct mem_cgroup *memcg,
> + unsigned int lru_mask)
> +{
> + u64 total = 0;
> + struct mem_cgroup *iter;
> +
> + for_each_mem_cgroup_tree(iter, memcg)
> + total += mem_cgroup_nr_lru_pages(iter, lru_mask);
Indentation
> +
> + return total;
> +}
> +
These do not need to be defined for !CONFIG_NUMA. I do not think this is
generally usable functionality. Just move it memcg_numa_stat_show
> void __mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx)
> {
> struct mem_cgroup *memcg;
> @@ -5267,6 +5293,45 @@ static int memcg_numa_stat_show(struct cgroup *cont, struct cftype *cft,
> seq_printf(m, " N%d=%lu", nid, node_nr);
> }
> seq_putc(m, '\n');
> +
> + total_nr = mem_cgroup_hierarchical_nr_lru_pages(memcg, LRU_ALL);
> + seq_printf(m, "hierarchical_total=%lu", total_nr);
> + for_each_node_state(nid, N_HIGH_MEMORY) {
> + node_nr =
> + mem_cgroup_node_hierarchical_nr_lru_pages(memcg, nid,
> + LRU_ALL);
> + seq_printf(m, " N%d=%lu", nid, node_nr);
> + }
> + seq_putc(m, '\n');
> +
> + file_nr = mem_cgroup_hierarchical_nr_lru_pages(memcg, LRU_ALL_FILE);
> + seq_printf(m, "hierarchical_file=%lu", file_nr);
> + for_each_node_state(nid, N_HIGH_MEMORY) {
> + node_nr = mem_cgroup_node_hierarchical_nr_lru_pages(memcg, nid,
> + LRU_ALL_FILE);
> + seq_printf(m, " N%d=%lu", nid, node_nr);
> + }
> + seq_putc(m, '\n');
> +
> + anon_nr = mem_cgroup_hierarchical_nr_lru_pages(memcg, LRU_ALL_ANON);
> + seq_printf(m, "hierarchical_anon=%lu", anon_nr);
> + for_each_node_state(nid, N_HIGH_MEMORY) {
> + node_nr = mem_cgroup_node_hierarchical_nr_lru_pages(memcg, nid,
> + LRU_ALL_ANON);
> + seq_printf(m, " N%d=%lu", nid, node_nr);
> + }
> + seq_putc(m, '\n');
> +
> + unevictable_nr = mem_cgroup_hierarchical_nr_lru_pages(memcg,
> + BIT(LRU_UNEVICTABLE));
> + seq_printf(m, "hierarchical_unevictable=%lu", unevictable_nr);
> + for_each_node_state(nid, N_HIGH_MEMORY) {
> + node_nr = mem_cgroup_node_hierarchical_nr_lru_pages(memcg, nid,
> + BIT(LRU_UNEVICTABLE));
> + seq_printf(m, " N%d=%lu", nid, node_nr);
> + }
> + seq_putc(m, '\n');
> +
> return 0;
> }
> #endif /* CONFIG_NUMA */
> --
> 1.8.1.3
>
--
Michal Hocko
SUSE Labs
--
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>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] memcg: refactor mem_control_numa_stat_show()
2013-04-08 21:58 [PATCH] memcg: support hierarchical memory.numa_stats Ying Han
2013-04-17 1:32 ` Michal Hocko
@ 2013-04-24 9:02 ` Greg Thelen
2013-04-24 9:02 ` [PATCH 2/2] memcg: support hierarchical memory.numa_stats Greg Thelen
1 sibling, 1 reply; 5+ messages in thread
From: Greg Thelen @ 2013-04-24 9:02 UTC (permalink / raw)
To: Michal Hocko, Johannes Weiner, KAMEZAWA Hiroyuki, Rik van Riel,
Hillf Danton, Hugh Dickins, Ying Han
Cc: linux-mm, Greg Thelen
Refactor mem_control_numa_stat_show() to use a new new stats structure
for smaller and simpler code. This consolidates nearly identical
code.
text rodata data bss
before 5,913,438 1,695,438 756,608 1,712,128
after 5,912,734 1,695,502 756,608 1,712,128
Signed-off-by: Greg Thelen <gthelen@google.com>
Signed-off-by: Ying Han <yinghan@google.com>
---
mm/memcontrol.c | 57 +++++++++++++++++++++++----------------------------------
1 file changed, 23 insertions(+), 34 deletions(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 2b55222..e73526e 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -5228,45 +5228,34 @@ static int mem_cgroup_move_charge_write(struct cgroup *cgrp,
static int memcg_numa_stat_show(struct cgroup *cont, struct cftype *cft,
struct seq_file *m)
{
+ struct numa_stat {
+ const char *name;
+ unsigned int lru_mask;
+ };
+
+ static const struct numa_stat stats[] = {
+ { "total", LRU_ALL },
+ { "file", LRU_ALL_FILE },
+ { "anon", LRU_ALL_ANON },
+ { "unevictable", BIT(LRU_UNEVICTABLE) },
+ { NULL, 0 } /* terminator */
+ };
+ const struct numa_stat *stat;
int nid;
- unsigned long total_nr, file_nr, anon_nr, unevictable_nr;
- unsigned long node_nr;
+ unsigned long nr;
struct mem_cgroup *memcg = mem_cgroup_from_cont(cont);
- total_nr = mem_cgroup_nr_lru_pages(memcg, LRU_ALL);
- seq_printf(m, "total=%lu", total_nr);
- for_each_node_state(nid, N_MEMORY) {
- node_nr = mem_cgroup_node_nr_lru_pages(memcg, nid, LRU_ALL);
- seq_printf(m, " N%d=%lu", nid, node_nr);
- }
- seq_putc(m, '\n');
-
- file_nr = mem_cgroup_nr_lru_pages(memcg, LRU_ALL_FILE);
- seq_printf(m, "file=%lu", file_nr);
- for_each_node_state(nid, N_MEMORY) {
- node_nr = mem_cgroup_node_nr_lru_pages(memcg, nid,
- LRU_ALL_FILE);
- seq_printf(m, " N%d=%lu", nid, node_nr);
- }
- seq_putc(m, '\n');
-
- anon_nr = mem_cgroup_nr_lru_pages(memcg, LRU_ALL_ANON);
- seq_printf(m, "anon=%lu", anon_nr);
- for_each_node_state(nid, N_MEMORY) {
- node_nr = mem_cgroup_node_nr_lru_pages(memcg, nid,
- LRU_ALL_ANON);
- seq_printf(m, " N%d=%lu", nid, node_nr);
+ for (stat = stats; stat->name; stat++) {
+ nr = mem_cgroup_nr_lru_pages(memcg, stat->lru_mask);
+ seq_printf(m, "%s=%lu", stat->name, nr);
+ for_each_node_state(nid, N_MEMORY) {
+ nr = mem_cgroup_node_nr_lru_pages(memcg, nid,
+ stat->lru_mask);
+ seq_printf(m, " N%d=%lu", nid, nr);
+ }
+ seq_putc(m, '\n');
}
- seq_putc(m, '\n');
- unevictable_nr = mem_cgroup_nr_lru_pages(memcg, BIT(LRU_UNEVICTABLE));
- seq_printf(m, "unevictable=%lu", unevictable_nr);
- for_each_node_state(nid, N_MEMORY) {
- node_nr = mem_cgroup_node_nr_lru_pages(memcg, nid,
- BIT(LRU_UNEVICTABLE));
- seq_printf(m, " N%d=%lu", nid, node_nr);
- }
- seq_putc(m, '\n');
return 0;
}
#endif /* CONFIG_NUMA */
--
1.8.2.1
--
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>
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] memcg: support hierarchical memory.numa_stats
2013-04-24 9:02 ` [PATCH 1/2] memcg: refactor mem_control_numa_stat_show() Greg Thelen
@ 2013-04-24 9:02 ` Greg Thelen
2013-04-24 9:22 ` [PATCH 2/2 v2] " Greg Thelen
0 siblings, 1 reply; 5+ messages in thread
From: Greg Thelen @ 2013-04-24 9:02 UTC (permalink / raw)
To: Michal Hocko, Johannes Weiner, KAMEZAWA Hiroyuki, Rik van Riel,
Hillf Danton, Hugh Dickins, Ying Han
Cc: linux-mm, Greg Thelen
From: Ying Han <yinghan@google.com>
The memory.numa_stat file was not hierarchical. Memory charged to the
children was not shown in parent's numa_stat.
This change adds the "hierarchical_" stats to the existing stats. The
new hierarchical stats include the sum of all children's values in
addition to the value of the memcg.
Tested: Create cgroup a, a/b and run workload under b. The values of
b are included in the "hierarchical_*" under a.
$ cat /dev/cgroup/memory/a/memory.numa_stat
total=0 N0=0 N1=0 N2=0 N3=0
file=0 N0=0 N1=0 N2=0 N3=0
anon=0 N0=0 N1=0 N2=0 N3=0
unevictable=0 N0=0 N1=0 N2=0 N3=0
hierarchical_total=21395 N0=0 N1=16 N2=21379 N3=0
hierarchical_file=21368 N0=0 N1=0 N2=21368 N3=0
hierarchical_anon=27 N0=0 N1=16 N2=11 N3=0
hierarchical_unevictable=0 N0=0 N1=0 N2=0 N3=0
$ cat /dev/cgroup/memory/a/b/memory.numa_stat
total=21395 N0=0 N1=16 N2=21379 N3=0
file=21368 N0=0 N1=0 N2=21368 N3=0
anon=27 N0=0 N1=16 N2=11 N3=0
unevictable=0 N0=0 N1=0 N2=0 N3=0
hierarchical_total=21395 N0=0 N1=16 N2=21379 N3=0
hierarchical_file=21368 N0=0 N1=0 N2=21368 N3=0
hierarchical_anon=27 N0=0 N1=16 N2=11 N3=0
hierarchical_unevictable=0 N0=0 N1=0 N2=0 N3=0
Signed-off-by: Ying Han <yinghan@google.com>
Signed-off-by: Greg Thelen <gthelen@google.com>
---
mm/memcontrol.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index e73526e..f0ec99d 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -5244,6 +5244,7 @@ static int memcg_numa_stat_show(struct cgroup *cont, struct cftype *cft,
int nid;
unsigned long nr;
struct mem_cgroup *memcg = mem_cgroup_from_cont(cont);
+ struct mem_cgroup *iter;
for (stat = stats; stat->name; stat++) {
nr = mem_cgroup_nr_lru_pages(memcg, stat->lru_mask);
@@ -5256,6 +5257,21 @@ static int memcg_numa_stat_show(struct cgroup *cont, struct cftype *cft,
seq_putc(m, '\n');
}
+ for (stat = stats; stat->name; stat++) {
+ nr = 0;
+ for_each_mem_cgroup_tree(iter, memcg)
+ nr += mem_cgroup_nr_lru_pages(iter, stat->lru_mask);
+ seq_printf(m, "hierarchical_%s=%lu", stat->name, nr);
+ for_each_node_state(nid, N_MEMORY) {
+ nr = 0;
+ for_each_mem_cgroup_tree(iter, memcg)
+ nr += mem_cgroup_node_nr_lru_pages(
+ iter, nid, stat->lru_mask);
+ seq_printf(m, " N%d=%lu", nid, nr);
+ }
+ seq_putc(m, '\n');
+ }
+
return 0;
}
#endif /* CONFIG_NUMA */
--
1.8.2.1
--
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>
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2 v2] memcg: support hierarchical memory.numa_stats
2013-04-24 9:02 ` [PATCH 2/2] memcg: support hierarchical memory.numa_stats Greg Thelen
@ 2013-04-24 9:22 ` Greg Thelen
0 siblings, 0 replies; 5+ messages in thread
From: Greg Thelen @ 2013-04-24 9:22 UTC (permalink / raw)
To: Michal Hocko, Johannes Weiner, KAMEZAWA Hiroyuki, Rik van Riel,
Hillf Danton, Hugh Dickins, Ying Han
Cc: linux-mm, Greg Thelen
From: Ying Han <yinghan@google.com>
The memory.numa_stat file was not hierarchical. Memory charged to the
children was not shown in parent's numa_stat.
This change adds the "hierarchical_" stats to the existing stats. The
new hierarchical stats include the sum of all children's values in
addition to the value of the memcg.
Tested: Create cgroup a, a/b and run workload under b. The values of
b are included in the "hierarchical_*" under a.
$ cat /dev/cgroup/memory/a/memory.numa_stat
total=0 N0=0 N1=0 N2=0 N3=0
file=0 N0=0 N1=0 N2=0 N3=0
anon=0 N0=0 N1=0 N2=0 N3=0
unevictable=0 N0=0 N1=0 N2=0 N3=0
hierarchical_total=21395 N0=0 N1=16 N2=21379 N3=0
hierarchical_file=21368 N0=0 N1=0 N2=21368 N3=0
hierarchical_anon=27 N0=0 N1=16 N2=11 N3=0
hierarchical_unevictable=0 N0=0 N1=0 N2=0 N3=0
$ cat /dev/cgroup/memory/a/b/memory.numa_stat
total=21395 N0=0 N1=16 N2=21379 N3=0
file=21368 N0=0 N1=0 N2=21368 N3=0
anon=27 N0=0 N1=16 N2=11 N3=0
unevictable=0 N0=0 N1=0 N2=0 N3=0
hierarchical_total=21395 N0=0 N1=16 N2=21379 N3=0
hierarchical_file=21368 N0=0 N1=0 N2=21368 N3=0
hierarchical_anon=27 N0=0 N1=16 N2=11 N3=0
hierarchical_unevictable=0 N0=0 N1=0 N2=0 N3=0
Signed-off-by: Ying Han <yinghan@google.com>
Signed-off-by: Greg Thelen <gthelen@google.com>
---
Changelog:
- v2: add documentation
Documentation/cgroups/memory.txt | 5 ++++-
mm/memcontrol.c | 16 ++++++++++++++++
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/Documentation/cgroups/memory.txt b/Documentation/cgroups/memory.txt
index 8b8c28b..b519e74 100644
--- a/Documentation/cgroups/memory.txt
+++ b/Documentation/cgroups/memory.txt
@@ -568,7 +568,10 @@ node. One of the use cases is evaluating application performance by
combining this information with the application's CPU allocation.
We export "total", "file", "anon" and "unevictable" pages per-node for
-each memcg. The ouput format of memory.numa_stat is:
+each memcg and "hierarchical_" for sum of all hierarchical children's values
+in addition to the memcg's own value.
+
+The ouput format of memory.numa_stat is:
total=<total pages> N0=<node 0 pages> N1=<node 1 pages> ...
file=<total file pages> N0=<node 0 pages> N1=<node 1 pages> ...
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index e73526e..f0ec99d 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -5244,6 +5244,7 @@ static int memcg_numa_stat_show(struct cgroup *cont, struct cftype *cft,
int nid;
unsigned long nr;
struct mem_cgroup *memcg = mem_cgroup_from_cont(cont);
+ struct mem_cgroup *iter;
for (stat = stats; stat->name; stat++) {
nr = mem_cgroup_nr_lru_pages(memcg, stat->lru_mask);
@@ -5256,6 +5257,21 @@ static int memcg_numa_stat_show(struct cgroup *cont, struct cftype *cft,
seq_putc(m, '\n');
}
+ for (stat = stats; stat->name; stat++) {
+ nr = 0;
+ for_each_mem_cgroup_tree(iter, memcg)
+ nr += mem_cgroup_nr_lru_pages(iter, stat->lru_mask);
+ seq_printf(m, "hierarchical_%s=%lu", stat->name, nr);
+ for_each_node_state(nid, N_MEMORY) {
+ nr = 0;
+ for_each_mem_cgroup_tree(iter, memcg)
+ nr += mem_cgroup_node_nr_lru_pages(
+ iter, nid, stat->lru_mask);
+ seq_printf(m, " N%d=%lu", nid, nr);
+ }
+ seq_putc(m, '\n');
+ }
+
return 0;
}
#endif /* CONFIG_NUMA */
--
1.8.2.1
--
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>
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-04-24 9:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-08 21:58 [PATCH] memcg: support hierarchical memory.numa_stats Ying Han
2013-04-17 1:32 ` Michal Hocko
2013-04-24 9:02 ` [PATCH 1/2] memcg: refactor mem_control_numa_stat_show() Greg Thelen
2013-04-24 9:02 ` [PATCH 2/2] memcg: support hierarchical memory.numa_stats Greg Thelen
2013-04-24 9:22 ` [PATCH 2/2 v2] " Greg Thelen
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).