From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=158.69.130.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793646462; b=u1G2cNMmOIYi65DBDAA3lhUI8eXWEDOwGzoyKL+i8LTc93M/pdr8khNL3fXEflXlV6DR x7k4tRljd3hydx8RcHzK01TRt2vv+kCBhtRyfqurCdH2H+xMMajCKuRinkPli3zf/+6Y0 1w95yeSi2wGBzvi6AbY0HZ9kk25amWgKSMo2piHp/w/1K0mVFDLA6iJSLQJXgFnVsiEYd +o1jV2r0SK0qM04noMFkOymr+jDmpa/VOD+vGwfdU3+KPFIm2jkI5GuiKDl0DxM9ffzCF ZbgYJHEGOekFNolAQBjelLbNaxHaPr8/h2NtOHKky8iV/xvNoaCeMDnqR0kHxHGruBg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793646462; h=DMARC-Filter:DKIM-Signature:Received:From:To:Cc:Subject:Date: Message-Id:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=gl+xnaBMZeBPaNesQCW4DnR4Om/hR26Eit0GPVIe2gw=; b=S5sBmMJHAVwzK514+pge8oc6oUqaq25DTvsD+AcLI9lReLA8REnKWU68x5Rsp4QOroCR wf4z1R4AYycR4WGBaRkYJPozb8ztcbDFDemlUXTY9EGMiH2AVpERTbgPYN5wPWQJISiBw K6VRvnguY1pZykp9F09z6EUQgwQBTvFlOkc0E/20fRPeK40N3j3YZjqHMuGS95sTziw6Y 8qVU8k25NaOGyvn7F0lpk1StV0HKHBv5HZOUwtF1iQDfUkx9SH5EHiFRegAUL4U1Jip4y 2irpSN+0jnEDHkVkCLBdV2csFsrQHIJTVl+WBb1yj3u/NuwH4dbQ+TtQkKD7qNRGCSQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=efficios.com; spf=pass smtp.mailfrom=efficios.com; dkim=pass header.d=efficios.com header.i=@efficios.com header.a=rsa-sha256 header.s=smtpout1 header.b=x8ZWFWyv; arc=none smtp.remote-ip=158.69.130.18 Received: from smtpout.efficios.com (smtpout.efficios.com [158.69.130.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D310606D81E; Mon, 2 Nov 2026 19:07:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8D310606D81E 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, unprotected) header.d=efficios.com header.i=@efficios.com header.a=rsa-sha256 header.s=smtpout1 header.b=x8ZWFWyv DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=smtpout1; t=1793646452; bh=gl+xnaBMZeBPaNesQCW4DnR4Om/hR26Eit0GPVIe2gw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x8ZWFWyvg7IxuyzujBtZkN7PotpTzTokkgemFKIggco3u1iiD8caRy/Xfxm3z4fnD iH1OHsV49U36dFW1xA2uSlGICrJgY9A6D7nkaBo9o2eIJTQj/UfIO4phT+cQUJeL2z YndnDs/YF3O/sca7+kdR62qmhflEiFdo4mSd3fuBcQrQy5o0nyAmIDcp2kclY97jv+ XLbtVqoXpHIYF0K1cPyZrCeHWepAYE4Y2wOlOIu/e8UTGSoV5ohmr86nMtFCgyjD0c Xv9e/1cBmi2zRjXXQBqYHElRiAx/4rvUGT1O1OCedNx8HIzSw9xgz/gbS4TXJ7NmaY /ZDLfxJLkRwqw== Received: from thinkos.internal.efficios.com (mtl.efficios.com [216.120.195.104]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4jJLn04x95zF1X; Mon, 02 Nov 2026 14:07:32 -0500 (EST) From: Mathieu Desnoyers To: David Hildenbrand 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 , Miaohe Lin , Al Viro , Yu Zhao , Roman Gushchin , Mateusz Guzik , Matthew Wilcox , Baolin Wang , Aboorva Devarajan , David Carlier , Josh Law , Andrew Morton , linux-mm@kvack.org, Jonathan Corbet , Shuah Khan , Randy Dunlap , linux-doc@vger.kernel.org, Kees Cook , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Ben Segall , Mel Gorman , Valentin Schneider , K Prateek Nayak , linux-trace-kernel@vger.kernel.org, Jan Kara , linux-fsdevel@vger.kernel.org, Oleg Nesterov Subject: [RFC PATCH v23 05/10] mm: report the approximate RSS in the rss_stat tracepoint Date: Mon, 2 Nov 2026 14:07:03 -0500 Message-Id: <20261102190708.1287100-6-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20261102190708.1287100-1-mathieu.desnoyers@efficios.com> References: <20261102190708.1287100-1-mathieu.desnoyers@efficios.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The rss_stat tracepoint is emitted on every RSS update, including each page fault. When it is enabled, it reports the precise sum of the RSS counter, which iterates over all possible CPUs for each event: 384 per page fault on a machine with 384 logical CPUs. Report the approximate sum of the hierarchical per-cpu counter instead, through get_mm_counter(), which reads the root of the counter tree. The size field of the event, the RSS counter after the update, is therefore within the accuracy bound of the counter from the precise value: within 158.5MB on a machine with 384 logical CPUs and 4kB pages. The tracepoint reports the precise sum since commit f1a7941243c1 ("mm: convert mm's rss stats into percpu_counter"). Before that, it reported an atomic counter which only received the per-task cached updates in batches. Signed-off-by: Mathieu Desnoyers Cc: "Paul E. McKenney" Cc: Steven Rostedt Cc: Masami Hiramatsu 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: Yu Zhao Cc: Roman Gushchin Cc: Mateusz Guzik Cc: Matthew Wilcox Cc: Baolin Wang Cc: Aboorva Devarajan Cc: David Carlier Cc: Josh Law Cc: Andrew Morton Cc: linux-mm@kvack.org --- Changes since v22: - Split from "mm: improve RSS counter approximation accuracy for proc interfaces", which now keeps reporting the precise sum. --- include/trace/events/kmem.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h index ac4c96db7638..8ee6d5df5961 100644 --- a/include/trace/events/kmem.h +++ b/include/trace/events/kmem.h @@ -448,7 +448,7 @@ TRACE_EVENT(rss_stat, */ __entry->curr = current->mm == mm && !(current->flags & PF_KTHREAD); __entry->member = member; - __entry->size = get_mm_counter_sum(mm, member) << PAGE_SHIFT; + __entry->size = get_mm_counter(mm, member) << PAGE_SHIFT; ), TP_printk("mm_id=%u curr=%d type=%s size=%ldB", -- 2.47.3