[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aAeAWVeLJT9bygA3@Asmaa.>
Date: Tue, 22 Apr 2025 04:41:13 -0700
From: Yosry Ahmed <yosry.ahmed@...ux.dev>
To: Shakeel Butt <shakeel.butt@...ux.dev>
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>, Waiman Long <llong@...hat.com>,
linux-mm@...ck.org, cgroups@...r.kernel.org,
linux-kernel@...r.kernel.org,
Meta kernel team <kernel-team@...a.com>
Subject: Re: [PATCH v2] memcg: optimize memcg_rstat_updated
On Wed, Apr 09, 2025 at 07:57:52PM -0700, Shakeel Butt wrote:
> Currently the kernel maintains the stats updates per-memcg which is
> needed to implement stats flushing threshold. On the update side, the
> update is added to the per-cpu per-memcg update of the given memcg and
> all of its ancestors. However when the given memcg has passed the
> flushing threshold, all of its ancestors should have passed the
> threshold as well. There is no need to traverse up the memcg tree to
> maintain the stats updates.
Nice. We also skip updating the per-CPU stats updates counter, which is
unnecessary in this case as well.
>
> Perf profile collected from our fleet shows that memcg_rstat_updated is
> one of the most expensive memcg function i.e. a lot of cumulative CPU
> is being spent on it. So, even small micro optimizations matter a lot.
> This patch is microbenchmarked with multiple instances of netperf on a
> single machine with locally running netserver and we see couple of
> percentage of improvement.
>
> Signed-off-by: Shakeel Butt <shakeel.butt@...ux.dev>
Reviewed-by: Yosry Ahmed <yosry.ahmed@...ux.dev>
Powered by blists - more mailing lists