Re: [PATCH 2/3] mm: memcg: add a helper for non-unified stats flushing

From: Michal Koutný
Date: Tue Aug 22 2023 - 09:01:08 EST


On Mon, Aug 21, 2023 at 08:54:57PM +0000, Yosry Ahmed <yosryahmed@xxxxxxxxxx> wrote:
> +static void do_stats_flush(struct mem_cgroup *memcg)
> +{
> + cgroup_rstat_flush(memcg->css.cgroup);
if(memcg == root_mem_cgroup)
atomic_set(&stats_flush_threshold, 0);
> +}
> +
> /*
> * do_unified_stats_flush - do a unified flush of memory cgroup statistics
> *
> @@ -656,7 +667,7 @@ static void do_unified_stats_flush(void)
>
> WRITE_ONCE(flush_next_time, jiffies_64 + 2*FLUSH_TIME);
>
> - cgroup_rstat_flush(root_mem_cgroup->css.cgroup);
> + do_stats_flush(root_mem_cgroup);
>
- atomic_set(&stats_flush_threshold, 0);
> atomic_set(&stats_flush_ongoing, 0);

You may reset stats_flush_threshold to save the unified flushers some
work.

Michal

Attachment: signature.asc
Description: PGP signature