Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1318365 > unrolled thread

[PATCH] mm: memcontrol: drop superfluous entry in the per-memcg stats array

Started byJohannes Weiner <hannes@cmpxchg.org>
First post2016-01-26 22:00 +0100
Last post2016-01-26 22:50 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] mm: memcontrol: drop superfluous entry in the per-memcg stats array Johannes Weiner <hannes@cmpxchg.org> - 2016-01-26 22:00 +0100
    Re: [PATCH] mm: memcontrol: drop superfluous entry in the per-memcg  stats array Andrew Morton <akpm@linux-foundation.org> - 2016-01-26 22:40 +0100
      Re: [PATCH] mm: memcontrol: drop superfluous entry in the per-memcg  stats array Johannes Weiner <hannes@cmpxchg.org> - 2016-01-26 22:50 +0100

#1318365 — [PATCH] mm: memcontrol: drop superfluous entry in the per-memcg stats array

FromJohannes Weiner <hannes@cmpxchg.org>
Date2016-01-26 22:00 +0100
Subject[PATCH] mm: memcontrol: drop superfluous entry in the per-memcg stats array
Message-ID<qViSv-1iC-37@gated-at.bofh.it>
MEM_CGROUP_STAT_NSTATS is just a delimiter for cgroup1 statistics, not
an actual array entry. Reuse it for the first cgroup2 stat entry, like
in the event array.

Fixes: b2807f07f4f8 ("mm: memcontrol: add "sock" to cgroup2 memory.stat")
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
---
 include/linux/memcontrol.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 9ae48d4aeb5e..792c8981e633 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -51,7 +51,7 @@ enum mem_cgroup_stat_index {
 	MEM_CGROUP_STAT_SWAP,		/* # of pages, swapped out */
 	MEM_CGROUP_STAT_NSTATS,
 	/* default hierarchy stats */
-	MEMCG_SOCK,
+	MEMCG_SOCK = MEM_CGROUP_STAT_NSTATS,
 	MEMCG_NR_STAT,
 };
 
-- 
2.7.0

[toc] | [next] | [standalone]


#1318415 — Re: [PATCH] mm: memcontrol: drop superfluous entry in the per-memcg stats array

FromAndrew Morton <akpm@linux-foundation.org>
Date2016-01-26 22:40 +0100
SubjectRe: [PATCH] mm: memcontrol: drop superfluous entry in the per-memcg stats array
Message-ID<qVjvc-1Q5-23@gated-at.bofh.it>
In reply to#1318365
On Tue, 26 Jan 2016 15:55:29 -0500 Johannes Weiner <hannes@cmpxchg.org> wrote:

> MEM_CGROUP_STAT_NSTATS is just a delimiter for cgroup1 statistics, not
> an actual array entry. Reuse it for the first cgroup2 stat entry, like
> in the event array.
> 
> ...
>
> --- a/include/linux/memcontrol.h
> +++ b/include/linux/memcontrol.h
> @@ -51,7 +51,7 @@ enum mem_cgroup_stat_index {
>  	MEM_CGROUP_STAT_SWAP,		/* # of pages, swapped out */
>  	MEM_CGROUP_STAT_NSTATS,
>  	/* default hierarchy stats */
> -	MEMCG_SOCK,
> +	MEMCG_SOCK = MEM_CGROUP_STAT_NSTATS,
>  	MEMCG_NR_STAT,
>  };

The code looks a bit odd.  How come mem_cgroup_stat_names[] ends with
"swap"?  Should MEMCG_SOCK be in there at all?

And the naming is a bit sad.  "MEM_CGROUP_STAT_FILE_MAPPED" maps to
"mapped_file", not "file_mapped".

[toc] | [prev] | [next] | [standalone]


#1318421 — Re: [PATCH] mm: memcontrol: drop superfluous entry in the per-memcg stats array

FromJohannes Weiner <hannes@cmpxchg.org>
Date2016-01-26 22:50 +0100
SubjectRe: [PATCH] mm: memcontrol: drop superfluous entry in the per-memcg stats array
Message-ID<qVjES-1TK-21@gated-at.bofh.it>
In reply to#1318415
On Tue, Jan 26, 2016 at 01:30:24PM -0800, Andrew Morton wrote:
> On Tue, 26 Jan 2016 15:55:29 -0500 Johannes Weiner <hannes@cmpxchg.org> wrote:
> 
> > MEM_CGROUP_STAT_NSTATS is just a delimiter for cgroup1 statistics, not
> > an actual array entry. Reuse it for the first cgroup2 stat entry, like
> > in the event array.
> > 
> > ...
> >
> > --- a/include/linux/memcontrol.h
> > +++ b/include/linux/memcontrol.h
> > @@ -51,7 +51,7 @@ enum mem_cgroup_stat_index {
> >  	MEM_CGROUP_STAT_SWAP,		/* # of pages, swapped out */
> >  	MEM_CGROUP_STAT_NSTATS,
> >  	/* default hierarchy stats */
> > -	MEMCG_SOCK,
> > +	MEMCG_SOCK = MEM_CGROUP_STAT_NSTATS,
> >  	MEMCG_NR_STAT,
> >  };
> 
> The code looks a bit odd.  How come mem_cgroup_stat_names[] ends with
> "swap"?  Should MEMCG_SOCK be in there at all?

It's cgroup1 vs. cgroup2 statistics. I'm using the same array in order
to use the original statistics infrastructure. It's a little weird, it
will be much cleaner once everything is converted to percpu_counter.

> And the naming is a bit sad.  "MEM_CGROUP_STAT_FILE_MAPPED" maps to
> "mapped_file", not "file_mapped".

MEM_CGROUP_STAT_FILE_MAPPED is named after NR_FILE_MAPPED because
they're both accounted from the same sites. Who knows why the
user-visible stat was then called mapped_file... :/

And in cgroup2 it's called file_mapped! At least there it'll be
consistent.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web