[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231202083129.3pmds2cddy765szr@google.com>
Date: Sat, 2 Dec 2023 08:31:29 +0000
From: Shakeel Butt <shakeelb@...gle.com>
To: Yosry Ahmed <yosryahmed@...gle.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Johannes Weiner <hannes@...xchg.org>,
Michal Hocko <mhocko@...nel.org>,
Roman Gushchin <roman.gushchin@...ux.dev>,
Muchun Song <muchun.song@...ux.dev>,
Ivan Babrou <ivan@...udflare.com>, Tejun Heo <tj@...nel.org>,
"Michal Koutný" <mkoutny@...e.com>,
Waiman Long <longman@...hat.com>, kernel-team@...udflare.com,
Wei Xu <weixugc@...gle.com>, Greg Thelen <gthelen@...gle.com>,
Domenico Cerasuolo <cerasuolodomenico@...il.com>,
linux-mm@...ck.org, cgroups@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [mm-unstable v4 5/5] mm: memcg: restore subtree stats flushing
On Wed, Nov 29, 2023 at 03:21:53AM +0000, Yosry Ahmed wrote:
[...]
> +void mem_cgroup_flush_stats(struct mem_cgroup *memcg)
> {
> - if (memcg_should_flush_stats(root_mem_cgroup))
> - do_flush_stats();
> + static DEFINE_MUTEX(memcg_stats_flush_mutex);
> +
> + if (mem_cgroup_disabled())
> + return;
> +
> + if (!memcg)
> + memcg = root_mem_cgroup;
> +
> + if (memcg_should_flush_stats(memcg)) {
> + mutex_lock(&memcg_stats_flush_mutex);
What's the point of this mutex now? What is it providing? I understand
we can not try_lock here due to targeted flushing. Why not just let the
global rstat serialize the flushes? Actually this mutex can cause
latency hiccups as the mutex owner can get resched during flush and then
no one can flush for a potentially long time.
> + /* Check again after locking, another flush may have occurred */
> + if (memcg_should_flush_stats(memcg))
> + do_flush_stats(memcg);
> + mutex_unlock(&memcg_stats_flush_mutex);
> + }
> }
Powered by blists - more mailing lists