Re: [PATCH RFC 1/2] memcg: use percpu_counter for statistics
From: Vladimir Davydov <hidden>
Date: 2014-09-12 07:41:22
Also in:
linux-mm, lkml
From: Vladimir Davydov <hidden>
Date: 2014-09-12 07:41:22
Also in:
linux-mm, lkml
On Fri, Sep 12, 2014 at 10:10:52AM +0900, Kamezawa Hiroyuki wrote:
(2014/09/12 0:41), Vladimir Davydov wrote:quoted
In the next patch I need a quick way to get a value of MEM_CGROUP_STAT_RSS. The current procedure (mem_cgroup_read_stat) is slow (iterates over all cpus) and may sleep (uses get/put_online_cpus), so it's a no-go. This patch converts memory cgroup statistics to use percpu_counter so that percpu_counter_read will do the trick. Signed-off-by: Vladimir Davydov <redacted>I have no strong objections but you need performance comparison to go with this. I thought percpu counter was messy to be used for "array". I can't understand why you started from fixing future performance problem before merging new feature.
Because the present implementation of mem_cgroup_read_stat may sleep (get/put_online_cpus) while I need to call it from atomic context in the next patch. I didn't do any performance comparisons, because it's just an RFC. It exists only to attract attention to the problem. Using percpu counters was the quickest way to implement a draft version, that's why I chose them. It may have performance impact though, so it shouldn't be merged w/o performance analysis. Thanks, Vladimir