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 A099643D50C; Fri, 27 Feb 2026 15:37:43 +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=1772206665; cv=none; b=ADznv/mWh9+zDhSMWLh0qxUC+dF6GJMCO9QND4wpNQcbLJsdd9w/wHFuFvQJHDRRatremu9Mm/oix7XQJN3fQKeOsXhVRX1oFV3Dh/wZDoF0SUyewZkDechIPAxABoaFyYH7Bi9rXNrTJdjuCi/UwywtCKNuM9biDiWgh18pd4M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772206665; c=relaxed/simple; bh=N2R00FJ+7d1k7JQ+iW5UMQ3SU4AEK5/LGNavzwQ8RVs=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=GtgkyiU/Bnzvavp0sphS8CgHeLpDxhMn1nw7m/mEhDOOCfrn9726ivqj8vBFK5QsiygEgDB7hGc5qcWFEJEuiQJX5Jtrvded2jd2JrV2JrTXC7TOQVJUUNGME90cR77AYl1bq0Cx2TZVxuq3/5JLFf4cPDN+P09VDTiD1Z/1K40= 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=QMHLFA8U; 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="QMHLFA8U" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=smtpout1; t=1772206656; bh=9FzERZOw4BS/qsQeVuofTxgYvCh8L3A5wSs6tnpu+HI=; h=From:To:Cc:Subject:Date:From; b=QMHLFA8UAdseSJWA+md/FvYuNDIJQ3lNdNBHgLQ3wBFeovfETUv+ev1bfYcvuin35 VwnVuUFoj/D92Sb9pQga5XPLxqmfN7q2slrBask0AXvmtKMnzwF1n0CksVXGs+fBIU 4u7bW44PFrb7H54b2XUCya/33rEoUgwAUAO/h/3UxkJuVKLkvX0PqPq0ECxf3TeUSI OuAUmNGQJTwQShuh0wgH8l1RzV/SGBP6WUM4rg97jRqcSR1bwSACYcfXAwiHoOP5ZW JuyS3f5epdYk6PKQnPmn0iRKF8+7xkabufclZCpgx6jqarS0igGhji6Y/yS9Py7Kdp 36Gd6lVEPdzCg== Received: from thinkos.internal.efficios.com (mtl.efficios.com [216.120.195.104]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4fMssD4BkMzKM1; Fri, 27 Feb 2026 10:37:36 -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 v18 0/3] Improve proc RSS accuracy Date: Fri, 27 Feb 2026 10:37:27 -0500 Message-Id: <20260227153730.1556542-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 introduces the hierarchical tree counter (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. This series is based on tag v7.0-rc1. The main changes since v17: - Fix patch series bissectability. - Export GPL symbols for kunit tests. - Improve kunit tests coverage. - Fix kunit tests wait queue head reinit bug. - Fix an out-of-bound on bootup on configurations where nr_cpu_ids is close to NR_CPUS. Andrew, this series targets 7.1. 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 lib: Test hierarchical per-cpu counters mm: Improve RSS counter approximation accuracy for proc interfaces .../core-api/percpu-counter-tree.rst | 75 ++ include/linux/mm.h | 19 +- include/linux/mm_types.h | 54 +- include/linux/percpu_counter_tree.h | 367 +++++++++ include/trace/events/kmem.h | 2 +- init/main.c | 2 + kernel/fork.c | 22 +- lib/Kconfig | 12 + lib/Makefile | 1 + lib/percpu_counter_tree.c | 702 ++++++++++++++++++ lib/tests/Makefile | 2 + lib/tests/percpu_counter_tree_kunit.c | 399 ++++++++++ 12 files changed, 1627 insertions(+), 30 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 create mode 100644 lib/tests/percpu_counter_tree_kunit.c -- 2.39.5