Web lists-archives.com

Re: [PATCH v3 6/6] mm: refactor memcg_hotplug_cpu_dead() to use memcg_flush_offline_percpu()




On Wed, Mar 13, 2019 at 11:39:53AM -0700, Roman Gushchin wrote:
> It's possible to remove a big chunk of the redundant code by making
> memcg_flush_offline_percpu() to take cpumask as an argument and flush
> percpu data on all cpus belonging to the mask instead of all possible cpus.
> 
> Then memcg_hotplug_cpu_dead() can call it with a single CPU bit set.
> 
> This approach allows to remove all duplicated code, but safe the
> performance optimization made in memcg_flush_offline_percpu():
> only one atomic operation per data entry.
> 
> for_each_data_entry()
> 	for_each_cpu(cpu. cpumask)
> 		sum_events()
> 	flush()
> 
> Otherwise it would be one atomic operation per data entry per cpu:
> for_each_cpu(cpu)
> 	for_each_data_entry()
> 		flush()
> 
> Signed-off-by: Roman Gushchin <guro@xxxxxx>

Acked-by: Johannes Weiner <hannes@xxxxxxxxxxx>