[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211013180130.GB22036@blackbody.suse.cz>
Date: Wed, 13 Oct 2021 20:01:30 +0200
From: Michal Koutný <mkoutny@...e.com>
To: Shakeel Butt <shakeelb@...gle.com>
Cc: Johannes Weiner <hannes@...xchg.org>,
Michal Hocko <mhocko@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
cgroups@...r.kernel.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/2] memcg: flush stats only if updated
On Fri, Oct 01, 2021 at 12:00:39PM -0700, Shakeel Butt <shakeelb@...gle.com> wrote:
> In this patch we kept the stats update codepath very minimal and let the
> stats reader side to flush the stats only when the updates are over a
> specific threshold. For now the threshold is (nr_cpus * CHARGE_BATCH).
BTW, a noob question -- are the updates always single page sized?
This is motivated by apples vs oranges comparison since the
nr_cpus * MEMCG_CHARGE_BATCH
suggests what could the expected error be in pages (bytes). But it's mostly
wrong since: a) uncertain single-page updates, b) various counter
updates summed together. I wonder whether the formula can serve to
provide at least some (upper) estimate.
> +static inline void memcg_rstat_updated(struct mem_cgroup *memcg)
> +{
> + cgroup_rstat_updated(memcg->css.cgroup, smp_processor_id());
> + if (!(__this_cpu_inc_return(stats_updates) % MEMCG_CHARGE_BATCH))
> + atomic_inc(&stats_flush_threshold);
> +}
Neat trick! (I guess there are no benchmarks complaining about this
(yet)).
Overall,
Reviewed-by: Michal Koutný <mkoutny@...e.com>
Powered by blists - more mailing lists