From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8BCAC83030 for ; Tue, 8 Jul 2025 02:16:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4F8C96B03B4; Mon, 7 Jul 2025 22:16:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4D0406B03B5; Mon, 7 Jul 2025 22:16:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 40D586B03B6; Mon, 7 Jul 2025 22:16:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 31BEB6B03B4 for ; Mon, 7 Jul 2025 22:16:45 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 961F616044A for ; Tue, 8 Jul 2025 02:16:44 +0000 (UTC) X-FDA: 83639483928.04.317AB4F Received: from out-184.mta0.migadu.com (out-184.mta0.migadu.com [91.218.175.184]) by imf12.hostedemail.com (Postfix) with ESMTP id B258A40009 for ; Tue, 8 Jul 2025 02:16:42 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=nPL9x1WE; spf=pass (imf12.hostedemail.com: domain of kent.overstreet@linux.dev designates 91.218.175.184 as permitted sender) smtp.mailfrom=kent.overstreet@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1751941003; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=GyO1/oWgoj/oRNoQ8OU4EZkYWykHEn/1uEQPa+kIrE4=; b=VXz0y7+VfE0G63m1d0HY+wUT/sAh41lZDUtcoJuJpfQMQZHpax5CBZe+/eeO+8qRL8DXPG OmTJsEFD5DaWg3KgYrhWFN4Q8c0K0w78IpKlj9EOJw0WtmxMayhz9vU1FY4bgB5Gl+zh8R 1gkMaaL3bwlSzHiZOefB0ab6ylHkNr0= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=nPL9x1WE; spf=pass (imf12.hostedemail.com: domain of kent.overstreet@linux.dev designates 91.218.175.184 as permitted sender) smtp.mailfrom=kent.overstreet@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1751941003; a=rsa-sha256; cv=none; b=wo3cwSZQBW1EZS0WhVQsAa7kVD4ap1BE19XECNEZ1HUkp9PJdzJuLYt6m+Pb0QUge5doEJ 28xMDkxdYADgw00Kd29pVeLgKRB/Sz2lYjFkfpZwCGO4zH/Nz+WwFs6BWO6mV6elFR/K3L cKu9cYNsTBP3GR/3rifQYnaMUL+djCI= Date: Mon, 7 Jul 2025 22:16:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1751941000; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GyO1/oWgoj/oRNoQ8OU4EZkYWykHEn/1uEQPa+kIrE4=; b=nPL9x1WEV9Mb2iA1i8aYhu53mtqP6ftNo+6nju+9KixdusTlYnzb2ysceu6ToAh9dryIwl djGenVmSZwe37svLlRP6M2wImeW9rnY2aKzNsnyktv/oJV4Pcg30KxPD00YpQ+PBrsCM7X KSE+f8awNXh5Yf2bukzXudA6bFyCz2M= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: Suren Baghdasaryan Cc: Li Zetao , Peter Zijlstra , Ingo Molnar , Steven Rostedt , akpm@linux-foundation.org, linux-mm@kvack.org Subject: Re: [PATCH mm-next] alloc_tag: add total bytes allocation information Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Migadu-Flow: FLOW_OUT X-Stat-Signature: dhxb9puwb94zsjazs9kbmxcgbjtuw741 X-Rspamd-Queue-Id: B258A40009 X-Rspam-User: X-Rspamd-Server: rspam07 X-HE-Tag: 1751941002-825090 X-HE-Meta: U2FsdGVkX1/Biy4JyunrqI9Wt24u1bKuj7CQdZG+yepk+4oI15z8Xq3cQkVxzw1r8HtI9aOUnXoYo47wRmsoXPaXhXbMZrztDwvFhA6kkRKcvU+1y7586Mj3erA18MOlggmA6SyELMr7URIn4/6IvKBu+uP5QzKnvQxHDOmNoHFbt6sHg/Z4t5WLVHdrTYmatPRnyHX/1EHSth2PRqkjdhQsTWfx+5yR8iqudvME630J8IwafipxiGsFU1/6NKfn1M1OkZ8nyJkZALi5lKq89Di40JsN6N21XXnsZgmtOo/iOEGbCWhbtaTrlBSZDeVt+umuAHcSE8AbFy6poqyuHlq+Be0Ar9xAuWfRj8I+AIwunB0r6HOtINfLqOLfW/m/OGBanDQB4jBPOqHT46AmJEGhaefifbUor1W4EdpQe+2/4nigz+BsDiqEGSp8gAxcbuy+ENm4QjKulpjpOJZvLmPg9o+/2fe8Ia2q33j+ANUvn+09dDu82OE78GIvuOlaKQJ92NSxOvoqa4hV7mXrAzowiAu/HBO4CQ04BQnyd7wLlVmTcue+/ERQN5WKggvkvzWl40NWlRgkXdXxWvewF6b4+46dO1Qk9R/2CSepbjRVFTO9sXplMqGlzku9ScvYXfLMOo8VS2C3OhcONb6kkeWHt7KWeQNE+QgPXVE5TqA6NPhwBxko97TXIMsJYHpCr9kE8NGEdrqTyxFupFBSaFA0n7YDlOlgqA0oSguEeAmcGOE3x4KUGiIqHUQh7cuB4XbwFDGskSFk1+KiQJG+AlGP9ktoiov5huo3RH9QZKip9ZsVLSM9PjEQ3Jl8CO+MFsLc50Rtg++hlheTc9UJFDZaJgGtormK592fiDFKdpqfeczDA61+/dtx26SUm4TR7V2Vr+zhR+9cMigShHs3ppGJ6ZhzHG6wa341pAStZDFzjJOSuzuX3rN9MXCo6yNWX8GJ00L/BTAD4iiHgUT cW0H+awX 25D8e09wvGHHbp6VF0L9pxR8buMUu50Yz1Tf5G7E1PYQR0riNFj2H5GID2btTPMUM4i65RCjw+zimsmugTEIEOw2YKBDAVn3WCwlbD6ltuSTAn42ZeGwLmZ9r2IzBRPIJl15uBLVCLDm3/Pzha2WyPk+sbGC4Z491pRnKNup0Fo5nr/OvEnxKJF/gDDy7528wJ7kCivtCrmKns05Z30aCrUyoQ8k94uybgrCakWmgXsFMtLMzL6vPAfywqIvCCos1ynbstllTSjjLW3N/hpXue6i1UpffvZdoGDDonRRfkef7Sfzh2c3gW//yHosWjEOirdEh9enYJPbUDpHwjBm1hqCcsF17boGIjq4jWhfdjKJWa0GompNrLNbjQ9WG0HJ4pUgD X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Mon, Jul 07, 2025 at 07:05:18PM -0700, Suren Baghdasaryan wrote: > On Sun, Jul 6, 2025 at 8:21 AM Kent Overstreet > wrote: > > > > On Sun, Jul 06, 2025 at 02:01:41PM +0800, Li Zetao wrote: > > > Hi, > > > > > > On 2025/7/3 1:14, Kent Overstreet wrote: > > > > +cc Peter, Ingo, Steven > > > > > > > > On Wed, Jul 02, 2025 at 12:38:06AM +0800, LiZetao wrote: > > > > > From bb3537ee638ac80eebcfe9160961e36df8d3ee4c Mon Sep 17 00:00:00 2001 > > > > > From: Li Zetao > > > > > Date: Tue, 1 Jul 2025 09:30:16 +0000 > > > > > Subject: [PATCH mm-next] alloc_tag: add total bytes allocation information > > > > > > > > > > Some performance monitoring tools focus on real-time memory > > > > > usage anddisplay the total amount of memory applied, which is > > > > > convenient for analyzing the memory usage ratio. > > > > > > > > > > Added total information in /proc/allocinfo to feedback the > > > > > total amount of memory applied to the user. Example is as > > > > > follows: > > > > > > > > > > root:~# cat /proc/allocinfo|tail > > > > > 98112 168 lib/radix-tree.c:338 func:__radix_tree_preload > > > > > 12848 22 lib/radix-tree.c:276 func:radix_tree_node_alloc > > > > > 300760 515 lib/radix-tree.c:253 func:radix_tree_node_alloc > > > > > 0 0 lib/xarray.c:1214 func:xas_try_split > > > > > 0 0 lib/xarray.c:1059 func:xas_split_alloc > > > > > 208488 357 lib/xarray.c:378 func:xas_alloc > > > > > 0 0 lib/xarray.c:344 func:__xas_nomem > > > > > 0 0 lib/xarray.c:341 func:__xas_nomem > > > > > 0 0 lib/xarray.c:309 func:xas_nomem > > > > > total: 102208196 > > Sorry for the late reply. > I'm trying to understand why this math has to be done in the kernel. > Why the userspace parser of this file can't simply read the file, > calculate the total allocations size and report it? I don't see the > value of doing that in the kernel as any allocation size can change at > any time even while we are reading this file. So, if you are concerned > about correctness of the reported total, it won't be any more correct > even if you do this inside the kernel AFAICT. exactly - hoping to nudge someone to write the userspace frontend :)