Re: [PATCH mm-new v3] mm/memcontrol: Add memory.stat_refresh for on-demand stats flushing
From: Waiman Long
Date: Tue Nov 11 2025 - 15:44:14 EST
On 11/11/25 2:47 PM, Michal Hocko wrote:
On Tue 11-11-25 14:10:28, Waiman Long wrote:
[...]
This effectivelly invalidates the primary purpose of the interface to+static void memcg_flush_stats(struct mem_cgroup *memcg, bool force)Shouldn't we impose a limit in term of how frequently this
+{
+ if (mem_cgroup_disabled())
+ return;
+
+ memcg = memcg ?: root_mem_cgroup;
+ __mem_cgroup_flush_stats(memcg, force);
+}
memcg_flush_stats() function can be called like at most a few times per
provide a method to get as-fresh-as-possible value AFAICS.
second to prevent abuse from user space as stat flushing is expensive? WeWhat exactly would be an attack vector?
should prevent some kind of user space DoS attack by using this new API if
we decide to implement it.
just repeatedly write a string to the new cgroup file. It will then call css_rstat_flush() repeatedly. It is not a real DoS attack, but it can still consume a lot of cpu time and slow down other tasks.
Cheers,
Longman