Re: [PATCH v2 1/5] memcg: make nocpu_base available for non hotplug

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue 05-03-13 17:10:54, Glauber Costa wrote:
> We are using nocpu_base to accumulate charges on the main counters
> during cpu hotplug. I have a similar need, which is transferring charges
> to the root cgroup when lazily enabling memcg. Because system wide
> information is not kept per-cpu, it is hard to distribute it. This field
> works well for this. So we need to make it available for all usages, not
> only hotplug cases.

Could you also rename it to something else while you are at it?
nocpu_base sounds outdated. What about overflow_base or something like
that.

I am also wondering why do wee need pcp_counter_lock there. Doesn't
get_online_cpus prevent from hotplug so mem_cgroup_drain_pcp_counter
doesn't get called? I am sorry for this stupid question but I am lost in
the hotplug callbacks...

Other than that I don't mind pulling nocpu_base outside the hotplug code
and reusing it for something else. So you can add my
Acked-by: Michal Hocko <mhocko@xxxxxxx>

but I would be happier with a better name of course ;)

> Signed-off-by: Glauber Costa <glommer@xxxxxxxxxxxxx>
> Cc: Michal Hocko <mhocko@xxxxxxx>
> Cc: Kamezawa Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx>
> Cc: Johannes Weiner <hannes@xxxxxxxxxxx>
> Cc: Tejun Heo <tj@xxxxxxxxxx>
> ---
>  mm/memcontrol.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 669d16a..b8b363f 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -921,11 +921,11 @@ static long mem_cgroup_read_stat(struct mem_cgroup *memcg,
>  	get_online_cpus();
>  	for_each_online_cpu(cpu)
>  		val += per_cpu(memcg->stat->count[idx], cpu);
> -#ifdef CONFIG_HOTPLUG_CPU
> +
>  	spin_lock(&memcg->pcp_counter_lock);
>  	val += memcg->nocpu_base.count[idx];
>  	spin_unlock(&memcg->pcp_counter_lock);
> -#endif
> +
>  	put_online_cpus();
>  	return val;
>  }
> @@ -945,11 +945,11 @@ static unsigned long mem_cgroup_read_events(struct mem_cgroup *memcg,
>  
>  	for_each_online_cpu(cpu)
>  		val += per_cpu(memcg->stat->events[idx], cpu);
> -#ifdef CONFIG_HOTPLUG_CPU
> +
>  	spin_lock(&memcg->pcp_counter_lock);
>  	val += memcg->nocpu_base.events[idx];
>  	spin_unlock(&memcg->pcp_counter_lock);
> -#endif
> +
>  	return val;
>  }
>  
> -- 
> 1.8.1.2
> 
> --
> To unsubscribe from this list: send the line "unsubscribe cgroups" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]