From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5CB20368D45 for ; Tue, 11 Aug 2026 11:48:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786448909; cv=none; b=Sie71e5kA9wDglprmvTPzg4DtYUE7jWOFPZS8bzUVn9iTaeEDIPeiupRNY/qqDP24wFsVcPEKu1VCkgxxiMNG0vQeIUVNF3HFIVYEqS9g1N4OFZkzuP67p9SqRrSQ0PP6lEFj2X4KiOtAuIELNaqoF3DuhJQt8be7VfJ7Za/c9I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786448909; c=relaxed/simple; bh=Wwpp2QBKxO80rQdmYtZq04G1A4n+7GSNMaf/gwqK3Vo=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=uu+iSfTwMe0rgQveI0uSuRZXdNFwkWCIGy3iOd5PEP3Z5KmZwvHcrR2SKeTv3volEt3g81R1QBl1/iJnTF4ArENwOIitAsC2mb7akPaFbPDFTJrrFEfybFhMd4aMeUBzjFFfFw2gdQG+Lk0zzDtAWDe/THmMz63oLYqpVzDDBbQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=F+0pyluA; arc=none smtp.client-ip=209.85.216.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="F+0pyluA" Received: by mail-pj1-f54.google.com with SMTP id 98e67ed59e1d1-38e88b60121so2555583a91.3 for ; Tue, 11 Aug 2026 04:48:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786448908; x=1787053708; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=Ss9z8frgXLbOyoae93z63ypP8jpNcSWpfGevNSq30Jc=; b=F+0pyluAyOvkVvCe0yyfUdAlOLfQTNSaptWat57t1ukwDFkMsiQICMbUaJ3XIB54ty 2BuJ4hlj0kRl8MjTcv+xnd1AwTkywTFS7KfYS+/xIzmFpnK9zKM0VRlY+mIEu2ERKGEL 8PCdKrxSY1jtifGlq8gsLcdRK+a5X/W5SgrRu6WDKnw5fbXH3xnT8Y7AcOeATfnsbniy BJ4XkpRZXM5HuedDkywBbHdgvG513yu7Au1GDkMDlsfIW9kzSkFqWv18EWmfactbIjzk TJfGISZblwINaTVsO4a0B7WqxTrKJUjYzM1Fm87A2ugOQJ5wFgvRstVBSg+mNAPnaEPN WP8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786448908; x=1787053708; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Ss9z8frgXLbOyoae93z63ypP8jpNcSWpfGevNSq30Jc=; b=hSUCVJU0NhwZkJ/EU6ZKFMoHwcLxL84g4KDXDSCYcpok3/DVY5JL3/nftBRHeX4n9Y o35jreGiYqcFPaKvJh3KztYA6j39g5xAUp83gi36rjvXYQ/hKLb8uJi0yDUJ5A3RK4UX eNiqD1ZCw2TVodcFx2NsDBelRp0sni4cVbWkzDlzYQ8OOeCzK7E4npBKyUt96EAiuKFI YxkPmhvyDDlsAoQpeNaV0zdfdrXW3daImCvKS6Vu4OHbNFbaMDrayNL16wjzVwwEci6X RFLwWTrh2TbM3rYkRFmLHUiU1jF6XoKdeXyCWduQ/bO9pB6zyjhUaQuzHVWW1KarZzUp lpxw== X-Forwarded-Encrypted: i=1; AHgh+RrPJM6oXTAqgilFscPQWr/tZr05OrsVX7S+UVrqxJhT4mRchAtG5TaUaTfKwCjOXkd5nr+jqHylc9lQomg=@vger.kernel.org X-Gm-Message-State: AOJu0YyRxAuRLJYbNt5J3F0PwY11A4zrHOSWrh7aQsaGVcQKm7vyOjsN kpVDDHwdma+Faj4vLEhJuGQp6QMduG9fIsaQb7/BVVufkdsbqtt4FYd8 X-Gm-Gg: AR+sD13AwidgNkKBUpFWGvJ59zQBsQPbYbB9gh7sBBTHMWmqI45UhBpPMPj0BovlkrS pvB3HduGk/0QKWYmFzjQWTi8BesqU5KKAwKa/QWP7pEkAeZviPR5Ev6LenL8L9uRcRv8SiY+3sl TZzBKC5CAG43iUwCOgXEmmBurAIj635tTBekSUVHP4tcDvDnuIS/p+0t0eicgMHUAHFRAP4KRCv UWnzT2U/5DoUT5OA9xP3WPQ8xaDloRmu1AaThMyExYOjKgNjxlwY531ybEpfmclWTiUhKWsTa+C ifEsb7wRjBQgAMyjnOKJ2UgOaBKRt9nxzMzT/DiUceI520WMJfwiGDd2PYA1OY7gvyBEu3h2ExS gbRHuG0e7EitycaYMgNIZpVnffFDBmlz57Bz4wnH8bNgXeFWrpW9PrIUIwIFFDBneI2n1NYAwdn 40hFCrgQLteJ9RpF7JtUhA/r2lUjA3Q34F7m52nEmgDlkwrcOdzEOdzLy76yPZQ3CusDzwlxAwO Rv5f2j7A4lMsKUrQTz3kzZsryAJ X-Received: by 2002:a17:90b:4c4b:b0:38e:659b:f366 with SMTP id 98e67ed59e1d1-392ec0efc61mr2838777a91.0.1786448907678; Tue, 11 Aug 2026 04:48:27 -0700 (PDT) Received: from bj-kjy-standalone-gaoxiang17.mioffice.cn ([43.224.245.230]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-392ee1e369esm1850103a91.2.2026.08.11.04.48.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Aug 2026 04:48:27 -0700 (PDT) From: Xiang Gao X-Google-Original-From: Xiang Gao To: Steven Rostedt Cc: Masami Hiramatsu , Mathieu Desnoyers , Lorenzo Stoakes , gao xu , yinchuang1@xiaomi.com, linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Xiang Gao Subject: [RFC] tracing: aggregate ring-buffer usage statistics Date: Tue, 11 Aug 2026 19:48:18 +0800 Message-Id: <20260811114818.1449933-1-gaoxiang17@xiaomi.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Hi, I would like to clarify the motivation for a tracing-specific memory usage interface. The original requirement comes from Android lost-RAM attribution. Ftrace ring-buffer data pages are not represented as a separate memory category, so userspace memory diagnostics may treat them as lost RAM. The memory can be spread across the global trace array, dynamically created tracing instances, and snapshot buffers. Userspace can read buffer_total_size_kb for the global trace array and each instance, but it has to discover and sum all instances, and snapshot buffer capacity is not exposed through the same per-instance total. On one Android device, the global buffer and 24 tracing instances accounted for 395,664 kB of ring-buffer data capacity. This makes the missing attribution significant for low-memory diagnostics. The core requirement is a stable tracing-specific interface that allows userspace to obtain the aggregate tracing buffer usage without walking all instances. It does not need to be part of /proc/meminfo or show_mem(). One possible interface would be under: /sys/kernel/tracing/trace_stats/ It could provide an aggregate buffer value together with a breakdown for main and snapshot buffers. Per-CPU statistics could also be added if useful. Thanks, Xiang