Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1308883
| From | Andrew Morton <akpm@linux-foundation.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 1/2] mm: memcontrol: basic memory statistics in cgroup2 memory controller |
| Date | 2016-01-13 23:50 +0100 |
| Message-ID | <qQCoN-6fT-1@gated-at.bofh.it> (permalink) |
| References | <qQBM7-5Z4-43@gated-at.bofh.it> <qQBM8-5Z4-65@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wed, 13 Jan 2016 17:01:08 -0500 Johannes Weiner <hannes@cmpxchg.org> wrote:
> Provide a cgroup2 memory.stat that provides statistics on LRU memory
> and fault event counters. More consumers and breakdowns will follow.
>
> ...
>
> @@ -5095,6 +5107,46 @@ static int memory_events_show(struct seq_file *m, void *v)
> return 0;
> }
>
> +static int memory_stat_show(struct seq_file *m, void *v)
> +{
> + struct mem_cgroup *memcg = mem_cgroup_from_css(seq_css(m));
> + int i;
> +
> + /* Memory consumer totals */
> +
> + seq_printf(m, "anon %lu\n",
> + tree_stat(memcg, MEM_CGROUP_STAT_RSS) * PAGE_SIZE);
Is there any reason why this won't overflow a longword on 32-bit?
> + seq_printf(m, "file %lu\n",
> + tree_stat(memcg, MEM_CGROUP_STAT_CACHE) * PAGE_SIZE);
> +
> + /* Per-consumer breakdowns */
> +
> + for (i = 0; i < NR_LRU_LISTS; i++) {
> + struct mem_cgroup *mi;
> + unsigned long val = 0;
> +
> + for_each_mem_cgroup_tree(mi, memcg)
> + val += mem_cgroup_nr_lru_pages(mi, BIT(i)) * PAGE_SIZE;
> + seq_printf(m, "%s %lu\n", mem_cgroup_lru_names[i], val);
> + }
> +
> + seq_printf(m, "file_mapped %lu\n",
> + tree_stat(memcg, MEM_CGROUP_STAT_FILE_MAPPED) * PAGE_SIZE);
> + seq_printf(m, "file_dirty %lu\n",
> + tree_stat(memcg, MEM_CGROUP_STAT_DIRTY) * PAGE_SIZE);
> + seq_printf(m, "file_writeback %lu\n",
> + tree_stat(memcg, MEM_CGROUP_STAT_WRITEBACK) * PAGE_SIZE);
> +
> + /* Memory management events */
> +
> + seq_printf(m, "pgfault %lu\n",
> + tree_events(memcg, MEM_CGROUP_EVENTS_PGFAULT));
> + seq_printf(m, "pgmajfault %lu\n",
> + tree_events(memcg, MEM_CGROUP_EVENTS_PGMAJFAULT));
> +
> + return 0;
> +}
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/2] mm: memcontrol: cgroup2 memory statistics Johannes Weiner <hannes@cmpxchg.org> - 2016-01-13 23:10 +0100
[PATCH 1/2] mm: memcontrol: basic memory statistics in cgroup2 memory controller Johannes Weiner <hannes@cmpxchg.org> - 2016-01-13 23:10 +0100
Re: [PATCH 1/2] mm: memcontrol: basic memory statistics in cgroup2 memory controller Andrew Morton <akpm@linux-foundation.org> - 2016-01-13 23:50 +0100
Re: [PATCH 1/2] mm: memcontrol: basic memory statistics in cgroup2 memory controller Johannes Weiner <hannes@cmpxchg.org> - 2016-01-14 21:30 +0100
Re: [PATCH 0/2] mm: memcontrol: cgroup2 memory statistics Andrew Morton <akpm@linux-foundation.org> - 2016-01-13 23:50 +0100
Re: [PATCH 0/2] mm: memcontrol: cgroup2 memory statistics Johannes Weiner <hannes@cmpxchg.org> - 2016-01-14 21:30 +0100
csiph-web