linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: memcontrol: eliminate root memory.current
@ 2015-10-21 18:49 Johannes Weiner
  2015-10-22  9:07 ` Michal Hocko
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Weiner @ 2015-10-21 18:49 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-mm, cgroups, linux-kernel, Michal Hocko, Tejun Heo

memory.current on the root level doesn't add anything that wouldn't be
more accurate and detailed using system statistics. It already doesn't
include slabs, and it'll be a pain to keep in sync when further memory
types are accounted in the memory controller. Remove it.

Note that this applies to the new unified hierarchy interface only.

Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
---
 mm/memcontrol.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Tejun, we should probably do this with the other controllers too.
I don't think it makes sense anywhere to shoddily duplicate the
system statistics on the controller root levels.

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 4f04510..c71fe40 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -5022,7 +5022,7 @@ static void mem_cgroup_bind(struct cgroup_subsys_state *root_css)
 static u64 memory_current_read(struct cgroup_subsys_state *css,
 			       struct cftype *cft)
 {
-	return mem_cgroup_usage(mem_cgroup_from_css(css), false);
+	return page_counter_read(&mem_cgroup_from_css(css)->memory);
 }
 
 static int memory_low_show(struct seq_file *m, void *v)
@@ -5134,6 +5134,7 @@ static int memory_events_show(struct seq_file *m, void *v)
 static struct cftype memory_files[] = {
 	{
 		.name = "current",
+		.flags = CFTYPE_NOT_ON_ROOT,
 		.read_u64 = memory_current_read,
 	},
 	{
-- 
2.6.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mm: memcontrol: eliminate root memory.current
  2015-10-21 18:49 [PATCH] mm: memcontrol: eliminate root memory.current Johannes Weiner
@ 2015-10-22  9:07 ` Michal Hocko
  2015-10-22 12:29   ` Johannes Weiner
  0 siblings, 1 reply; 3+ messages in thread
From: Michal Hocko @ 2015-10-22  9:07 UTC (permalink / raw)
  To: Johannes Weiner; +Cc: Andrew Morton, linux-mm, cgroups, linux-kernel, Tejun Heo

On Wed 21-10-15 14:49:54, Johannes Weiner wrote:
> memory.current on the root level doesn't add anything that wouldn't be
> more accurate and detailed using system statistics. It already doesn't
> include slabs, and it'll be a pain to keep in sync when further memory
> types are accounted in the memory controller. Remove it.
> 
> Note that this applies to the new unified hierarchy interface only.

OK, I can understand your reasoning, other knobs are !root as well.

> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>

After the bug mentioned below is fixed
Acked-by: Michal Hocko <mhocko@suse.com>

> ---
>  mm/memcontrol.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> Tejun, we should probably do this with the other controllers too.
> I don't think it makes sense anywhere to shoddily duplicate the
> system statistics on the controller root levels.
> 
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 4f04510..c71fe40 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -5022,7 +5022,7 @@ static void mem_cgroup_bind(struct cgroup_subsys_state *root_css)
>  static u64 memory_current_read(struct cgroup_subsys_state *css,
>  			       struct cftype *cft)
>  {
> -	return mem_cgroup_usage(mem_cgroup_from_css(css), false);
> +	return page_counter_read(&mem_cgroup_from_css(css)->memory);

We want that in bytes though.

>  }
>  
>  static int memory_low_show(struct seq_file *m, void *v)
> @@ -5134,6 +5134,7 @@ static int memory_events_show(struct seq_file *m, void *v)
>  static struct cftype memory_files[] = {
>  	{
>  		.name = "current",
> +		.flags = CFTYPE_NOT_ON_ROOT,
>  		.read_u64 = memory_current_read,
>  	},
>  	{
> -- 
> 2.6.1

-- 
Michal Hocko
SUSE Labs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mm: memcontrol: eliminate root memory.current
  2015-10-22  9:07 ` Michal Hocko
@ 2015-10-22 12:29   ` Johannes Weiner
  0 siblings, 0 replies; 3+ messages in thread
From: Johannes Weiner @ 2015-10-22 12:29 UTC (permalink / raw)
  To: Michal Hocko; +Cc: Andrew Morton, linux-mm, cgroups, linux-kernel, Tejun Heo

On Thu, Oct 22, 2015 at 11:07:56AM +0200, Michal Hocko wrote:
> On Wed 21-10-15 14:49:54, Johannes Weiner wrote:
> > memory.current on the root level doesn't add anything that wouldn't be
> > more accurate and detailed using system statistics. It already doesn't
> > include slabs, and it'll be a pain to keep in sync when further memory
> > types are accounted in the memory controller. Remove it.
> > 
> > Note that this applies to the new unified hierarchy interface only.
> 
> OK, I can understand your reasoning, other knobs are !root as well.
> 
> > Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
> 
> After the bug mentioned below is fixed
> Acked-by: Michal Hocko <mhocko@suse.com>

Thanks!

> > @@ -5022,7 +5022,7 @@ static void mem_cgroup_bind(struct cgroup_subsys_state *root_css)
> >  static u64 memory_current_read(struct cgroup_subsys_state *css,
> >  			       struct cftype *cft)
> >  {
> > -	return mem_cgroup_usage(mem_cgroup_from_css(css), false);
> > +	return page_counter_read(&mem_cgroup_from_css(css)->memory);
> 
> We want that in bytes though.

Right you are, thanks for catching that.

Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
---
 mm/memcontrol.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index c71fe40..2cd149e 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -5022,7 +5022,9 @@ static void mem_cgroup_bind(struct cgroup_subsys_state *root_css)
 static u64 memory_current_read(struct cgroup_subsys_state *css,
 			       struct cftype *cft)
 {
-	return page_counter_read(&mem_cgroup_from_css(css)->memory);
+	struct mem_cgroup *memcg = mem_cgroup_from_css(css);
+
+	return (u64)page_counter_read(&memcg->memory) * PAGE_SIZE;
 }
 
 static int memory_low_show(struct seq_file *m, void *v)
-- 
2.6.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-10-22 12:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-21 18:49 [PATCH] mm: memcontrol: eliminate root memory.current Johannes Weiner
2015-10-22  9:07 ` Michal Hocko
2015-10-22 12:29   ` Johannes Weiner

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).