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=1793911011; b=peL4gmzIRgb+jJWUWSvNtwrNIZ+qohHDPEzhw+XISW8l87CRvwu3R+d7CheX1a9AtyNH PLffg00xE1j0+GsZBojr++pSztDC4qvAKp/yr1hno+XjTMc3yzU56n43j63HtgJDbHCvH dQMBATT/UAjTDLvM1kyqC700HEjqfgV7ODnAaYvlLVPp+HIJOcnVDGEM/m2BbB/od7h5f /ijbdoLhCMIZ+jSPiD4ZEstm5AqDc76rZeQkz/RZNDvOmgtYs1uLshf6VYD1Yu4/slnvt Mg6jmpvif4o+18k8W0uwQ9qFJgmkwB5PuITvpOYram7IzASq22OjVMWI7GAWCbK/gzA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793911011; 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=B2i0ZK07PlEBtX0QbaKuDG+2M0dY7t2yh0/Eybj/INg=; b=GLyRcANvBiE6/rdh1iAm8zIFXAU/llV4Gjvic170ILV2s8MXLZUzNFqWEfM30PBaOESZ aRYY10XZLpAHQ0I4QJ8XqVZtNYPija3jU2ehxayQVwJd3l/bbRFmSaHRKobfv5o/rKE9G 75D/9/Ks7SsPmpdRP51wPchGbQoX2LtQxs2caerhKB8roX8W71SHUPr3CnUZMxQVEXRK3 QW68MBB7bnsJS6Ne/N65ErsepeqdI5BfuBzb2E0yzF0OVb9mwxLoLAQMmDvp0NwOsVrc+ PXbI/dQZouXFurIizhZcFCtwopSl6fp74BFQC/A9tktsbGNi3tcPck83RPDVt7M0nnQ== 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=x5AekszR; 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 3C5B0606D803; Thu, 5 Nov 2026 20:36:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3C5B0606D803 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=x5AekszR DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=smtpout1; t=1793911008; bh=B2i0ZK07PlEBtX0QbaKuDG+2M0dY7t2yh0/Eybj/INg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x5AekszRqXdfQwKV+XhbMkYVoRhiQbfwjJnTLEDMQh7V2jor+1hO646aM2nSp2BN1 P9VGVFbGxo8czJ/HoUNyrOxeZTGt62/CZF3QeP6a9PYcsOMYF7X44ZwTRrYYj65KFc Ud9/qEmBCCsSyYE/BPDh4AjeJ13l9gBbtthCIuuRcO1QYCxHB8oIUJwuLIGgN6zuDH MqlPItIlReuqKWqCzrWRGGsh+bBDUpg7H25DnJIDqRnqmsAXV/bCMqc/AoSjV5y2Kp 1sNG2K6vEJ4lqf3SHbN9wpgoTK5JTe+ToKt1ojOy+hvFr3EgQRIzskf69nxUeXibOp MhZFIw13rrdsA== Received: from thinkos.internal.efficios.com (mtl.efficios.com [216.120.195.104]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4jLDcc1LV9zM4n; Thu, 05 Nov 2026 15:36:48 -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 , Andrew Morton , linux-mm@kvack.org, Jonathan Corbet , Shuah Khan , Randy Dunlap , linux-doc@vger.kernel.org, Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Ben Segall , Mel Gorman , Valentin Schneider , K Prateek Nayak , Kees Cook , linux-trace-kernel@vger.kernel.org, Jan Kara , linux-fsdevel@vger.kernel.org, Oleg Nesterov Subject: [RFC PATCH v24 05/10] mm: report the approximate RSS in the rss_stat tracepoint Date: Thu, 5 Nov 2026 15:36:34 -0500 Message-Id: <20261105203639.1459524-6-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20261105203639.1459524-1-mathieu.desnoyers@efficios.com> References: <20261105203639.1459524-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: 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