On Thu, Feb 24, 2022 at 02:46:27PM +0000, Daniel Dao wrote:
[...]
3) Summary of stack traces when mem_cgroup_flush_stats is over 5ms
Can you please check if flush_memcg_stats_dwork() appears in any stack
traces at all?
[...]
>
> If that patch did not help then we either have to optimize rstat
> flushing or further increase the update buffer which is nr_cpus * 32.
I think overall, we don't see any significant improvements. The
appearance of
expensive mem_cgroup_flush_stats is still there.
Thanks for testing. At the moment I am suspecting the async worker is
not getting the CPU. Can you share your CONFIG_HZ setting? Also can you
try the following patch and see if that helps otherwise keep halving the
delay (i.e. 2HZ -> HZ -> HZ/2 -> ...) and find at what value the issue
you are seeing get resolved?
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 32ba963ebf2e..198a7baaeeb7 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -685,7 +685,7 @@ void mem_cgroup_flush_stats(void)
static void flush_memcg_stats_dwork(struct work_struct *w)
{
__mem_cgroup_flush_stats();
- queue_delayed_work(system_unbound_wq, &stats_flush_dwork, 2UL*HZ);
+ queue_delayed_work(system_unbound_wq, &stats_flush_dwork, HZ);
}
/**