Introduce hierarchical per-cpu counters and use them for rss tracking to fix the per-mm RSS tracking which has become too inaccurate for OOM killer purposes on large many-core systems.
The approach proposed here is to replace this by the hierarchical per-cpu counters, which bounds the inaccuracy based on the system topology with O(N*logN). Testing and feedback are welcome! Thanks, Mathieu Cc: Andrew Morton <a...@linux-foundation.org> Cc: "Paul E. McKenney" <paul...@kernel.org> Cc: Steven Rostedt <rost...@goodmis.org> Cc: Masami Hiramatsu <mhira...@kernel.org> Cc: Mathieu Desnoyers <mathieu.desnoy...@efficios.com> Cc: Dennis Zhou <den...@kernel.org> Cc: Tejun Heo <t...@kernel.org> Cc: Christoph Lameter <c...@linux.com> Cc: Martin Liu <liumar...@google.com> Cc: David Rientjes <rient...@google.com> Cc: christian.koe...@amd.com Cc: Shakeel Butt <shakeel.b...@linux.dev> Cc: Johannes Weiner <han...@cmpxchg.org> Cc: Sweet Tea Dorminy <sweet...@google.com> Cc: Lorenzo Stoakes <lorenzo.stoa...@oracle.com> Cc: "Liam R . Howlett" <liam.howl...@oracle.com> Cc: Suren Baghdasaryan <sur...@google.com> Cc: Vlastimil Babka <vba...@suse.cz> Cc: Christian Brauner <brau...@kernel.org> Cc: Wei Yang <richard.weiy...@gmail.com> Cc: David Hildenbrand <da...@redhat.com> Cc: Miaohe Lin <linmia...@huawei.com> Cc: Al Viro <v...@zeniv.linux.org.uk> Cc: linux...@kvack.org Cc: linux-trace-kernel@vger.kernel.org Cc: Yu Zhao <yuz...@google.com> Cc: Roman Gushchin <roman.gushc...@linux.dev> Cc: Mateusz Guzik <mjgu...@gmail.com> Cc: Matthew Wilcox <wi...@infradead.org> Mathieu Desnoyers (2): lib: Introduce hierarchical per-cpu counters mm: Fix OOM killer inaccuracy on large many-core systems include/linux/mm.h | 8 +- include/linux/mm_types.h | 4 +- include/linux/percpu_counter_tree.h | 108 ++++++++ include/trace/events/kmem.h | 2 +- kernel/fork.c | 31 ++- lib/Makefile | 1 + lib/percpu_counter_tree.c | 393 ++++++++++++++++++++++++++++ 7 files changed, 530 insertions(+), 17 deletions(-) create mode 100644 include/linux/percpu_counter_tree.h create mode 100644 lib/percpu_counter_tree.c -- 2.39.5