From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpout.efficios.com (smtpout.efficios.com [158.69.130.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2F15B2F90E0; Wed, 14 Jan 2026 14:59:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=158.69.130.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768402762; cv=none; b=dyvfjcqCePteU9kIqjWI/ws4Ahh9/U5PDVvPwyNpSTtAWt0gDT4E1SpBcMnQU7jbXLWGnqUvc6TTvlbUIrasFnq15Uv8w5R6j8rgzVO+djQ9T3/qiFLCMPJ1tug+2bIt3cMU6WwGQX+CTE+mNtJAlynNXVcKAcBVW9ABUT5Egqo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768402762; c=relaxed/simple; bh=f8KxKxUhrmg9qpYVR2Ttw+Tqn+BmnGT7lyNSIYQ+mxo=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=iLzq+cdDOf42ds+7xpV+wYlLBAw4mPAlyg7xTkuKjkH4ZeC//1oi2Uvn0gy2DfIsE601Yzc61GoYwuAmWnBqj9aE4iEWaef/vqEN9wLuoEJsOhD1w5MOfuFUIYEZDugjoqYSHaHzotB1Ty3/Z7Hu/fxAMcfI/dpsRZ/d4h85RMs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com; spf=pass smtp.mailfrom=efficios.com; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b=EgpdmmB0; arc=none smtp.client-ip=158.69.130.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=efficios.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="EgpdmmB0" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=smtpout1; t=1768402760; bh=gmDWQxZXl+iq5JtzXMv1UfK4Kj8WDaLba3HxCXNbTAQ=; h=From:To:Cc:Subject:Date:From; b=EgpdmmB0iMS3s52XNQ4OgK/nv1/dt8wN4bABj6J/VpYqJeI+Lwqj6hh/z22KzuxbP D6VTr8rQAP07R2bVV3x7I8EvA50BSRZK9xTbbr6fZJ0J7gjOgIGDXUO88eKKlcYz1+ MbBLEcMlJGKQ/pCMgU+fY/bsJBXBDmla5XwPscX4mBRUZphWBCU4yCnbzrvRyuCrVq JsEvgMAbJM5OQYBYpIhaidMLaCaOpo9DDEnyH/TNZ78Y/DX45AUhiAVF2gCVXiF/Fh KaD6/13uRKUplAwxGTUm6/bKtq7d1jnydfPPube5mmOxltUe7YTZ6/GpBiR6H3lY1e qmCxRnV3dyRnw== Received: from thinkos.internal.efficios.com (mtl.efficios.com [216.120.195.104]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4drq5N0jGHzkxF; Wed, 14 Jan 2026 09:59:20 -0500 (EST) From: Mathieu Desnoyers To: Andrew Morton Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , "Paul E. McKenney" , Steven Rostedt , Masami Hiramatsu , Dennis Zhou , Tejun Heo , Christoph Lameter , Martin Liu , David Rientjes , christian.koenig@amd.com, Shakeel Butt , SeongJae Park , Michal Hocko , Johannes Weiner , Sweet Tea Dorminy , Lorenzo Stoakes , "Liam R . Howlett" , Mike Rapoport , Suren Baghdasaryan , Vlastimil Babka , Christian Brauner , Wei Yang , David Hildenbrand , Miaohe Lin , Al Viro , linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, Yu Zhao , Roman Gushchin , Mateusz Guzik , Matthew Wilcox , Baolin Wang , Aboorva Devarajan Subject: [PATCH v16 0/3] Improve proc RSS accuracy and OOM killer latency Date: Wed, 14 Jan 2026 09:59:12 -0500 Message-Id: <20260114145915.49926-1-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.5 Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This series use the hierarchical tree counter approximation (hpcc) to: * Increase accuracy of approximated RSS counters exposed through proc interfaces: With a test program hopping across CPUs doing frequent mmap/munmap operations, the upstream implementation approximation reaches a 1GB delta from the precise value after a few minutes, compared to a 80MB delta with the hierarchical counter. The hierarchical counter provides a guaranteed maximum approximation inaccuracy of 192MB on that hardware topology. * Implement the OOM killer task selection with a 2-pass algorithm. This is a latency reduction improvement of the OOM killer task selection: Testing the execution time of select_bad_process() with a single tail -f /dev/zero: AMD EPYC 9654 96-Core (2 sockets) Within a KVM, configured with 256 logical cpus. | precise sum | hpcc | ----------------------------------|-------------|----------| nr_processes=40 | 0.5 ms | 0.3 ms | nr_processes=10000 | 80.0 ms | 7.9 ms | I'm sending this series to gather feedback. I plan to re-submit it for inclusion into mm-new _after_ the next merge window closes, so the bug fix "mm: Fix OOM killer inaccuracy on large many-core systems" can be tested in the current release cycle. Andrew, if you have a prior version of this specific series in mm-new, please drop it for now. This series is based on v6.19-rc4, on top of the following three preparation series: https://lore.kernel.org/linux-mm/20251224173358.647691-1-mathieu.desnoyers@efficios.com/T/#t https://lore.kernel.org/linux-mm/20251224173810.648699-1-mathieu.desnoyers@efficios.com/T/#t https://lore.kernel.org/linux-mm/20260114143642.47333-1-mathieu.desnoyers@efficios.com/ Thanks, Mathieu Cc: Andrew Morton Cc: "Paul E. McKenney" Cc: Steven Rostedt Cc: Masami Hiramatsu Cc: Mathieu Desnoyers Cc: Dennis Zhou Cc: Tejun Heo Cc: Christoph Lameter Cc: Martin Liu Cc: David Rientjes Cc: christian.koenig@amd.com Cc: Shakeel Butt Cc: SeongJae Park Cc: Michal Hocko Cc: Johannes Weiner Cc: Sweet Tea Dorminy Cc: Lorenzo Stoakes Cc: "Liam R . Howlett" Cc: Mike Rapoport Cc: Suren Baghdasaryan Cc: Vlastimil Babka Cc: Christian Brauner Cc: Wei Yang Cc: David Hildenbrand Cc: Miaohe Lin Cc: Al Viro Cc: linux-mm@kvack.org Cc: linux-trace-kernel@vger.kernel.org Cc: Yu Zhao Cc: Roman Gushchin Cc: Mateusz Guzik Cc: Matthew Wilcox Cc: Baolin Wang Cc: Aboorva Devarajan Mathieu Desnoyers (3): lib: Introduce hierarchical per-cpu counters mm: Improve RSS counter approximation accuracy for proc interfaces mm: Reduce latency of OOM killer task selection with 2-pass algorithm .../core-api/percpu-counter-tree.rst | 75 ++ fs/proc/base.c | 2 +- include/linux/mm.h | 49 +- include/linux/mm_types.h | 54 +- include/linux/oom.h | 11 +- include/linux/percpu_counter_tree.h | 367 ++++++++++ include/trace/events/kmem.h | 2 +- init/main.c | 2 + kernel/fork.c | 22 +- lib/Makefile | 1 + lib/percpu_counter_tree.c | 679 ++++++++++++++++++ mm/oom_kill.c | 84 ++- 12 files changed, 1295 insertions(+), 53 deletions(-) create mode 100644 Documentation/core-api/percpu-counter-tree.rst create mode 100644 include/linux/percpu_counter_tree.h create mode 100644 lib/percpu_counter_tree.c -- 2.39.5