[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f90d7646-99a3-48f5-ba2e-850c73592080@gentwo.org>
Date: Tue, 8 Apr 2025 09:37:18 -0700 (PDT)
From: "Christoph Lameter (Ampere)" <cl@...two.org>
To: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
cc: Sweet Tea Dorminy <sweettea@...gle.com>, Mateusz Guzik <mjguzik@...il.com>,
linux-kernel@...r.kernel.org, Andrew Morton <akpm@...ux-foundation.org>,
"Paul E. McKenney" <paulmck@...nel.org>,
Steven Rostedt <rostedt@...dmis.org>,
Masami Hiramatsu <mhiramat@...nel.org>, Dennis Zhou <dennis@...nel.org>,
Tejun Heo <tj@...nel.org>, Martin Liu <liumartin@...gle.com>,
David Rientjes <rientjes@...gle.com>, christian.koenig@....com,
Shakeel Butt <shakeel.butt@...ux.dev>,
Johannes Weiner <hannes@...xchg.org>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
"Liam R . Howlett" <Liam.Howlett@...cle.com>,
Suren Baghdasaryan <surenb@...gle.com>, Vlastimil Babka <vbabka@...e.cz>,
Christian Brauner <brauner@...nel.org>,
Wei Yang <richard.weiyang@...il.com>, David Hildenbrand <david@...hat.com>,
Miaohe Lin <linmiaohe@...wei.com>, Al Viro <viro@...iv.linux.org.uk>,
linux-mm@...ck.org, linux-trace-kernel@...r.kernel.org,
Yu Zhao <yuzhao@...gle.com>, Roman Gushchin <roman.gushchin@...ux.dev>,
Matthew Wilcox <willy@...radead.org>
Subject: Re: [RFC PATCH v2] Introduce Hierarchical Per-CPU Counters
On Tue, 8 Apr 2025, Mathieu Desnoyers wrote:
> - Minimize contention when incrementing and decrementing counters,
> - Provide fast access to a sum approximation,
In general I like this as a abstraction of the Zoned VM counters in
vmstat.c that will make the scalable counters there useful elsewhere.
> It aims at fixing the per-mm RSS tracking which has become too
> inaccurate for OOM killer purposes on large many-core systems [1].
There are numerous cases where these issues occur. I know of a few I could
use something like this.
> The hierarchical per-CPU counters propagate a sum approximation through
> a binary tree. When reaching the batch size, the carry is propagated
> through a binary tree which consists of log2(nr_cpu_ids) levels. The
> batch size for each level is twice the batch size of the prior level.
A binary tree? Could we do this N-way? Otherwise the tree will be 8 levels
on a 512 cpu machine. Given the inflation of the number of cpus this
scheme better work up to 8K cpus.
> +int percpu_counter_tree_precise_sum(struct percpu_counter_tree *counter);
> +int percpu_counter_tree_precise_compare(struct percpu_counter_tree *a, struct percpu_counter_tree *b);
> +int percpu_counter_tree_precise_compare_value(struct percpu_counter_tree *counter, int v);
Precise? Concurrent counter updates can occur while determining the global
value. People may get confused.
Also maybe there would be a need for a function to collape the values into
the global if f.e. a cpu goes off line or in order to switch off OS
activities on a cpu.
Powered by blists - more mailing lists