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 95FD9C83F09 for ; Tue, 8 Jul 2025 14:38:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 22A4E6B0107; Tue, 8 Jul 2025 10:38:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 201DB6B016F; Tue, 8 Jul 2025 10:38:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 13F156B0170; Tue, 8 Jul 2025 10:38:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 013CD6B0107 for ; Tue, 8 Jul 2025 10:38:55 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id B2A3016060D for ; Tue, 8 Jul 2025 14:38:55 +0000 (UTC) X-FDA: 83641354230.26.22E0933 Received: from mail-qt1-f182.google.com (mail-qt1-f182.google.com [209.85.160.182]) by imf13.hostedemail.com (Postfix) with ESMTP id D0E9220014 for ; Tue, 8 Jul 2025 14:38:53 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=yzBIZ9h3; spf=pass (imf13.hostedemail.com: domain of surenb@google.com designates 209.85.160.182 as permitted sender) smtp.mailfrom=surenb@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1751985533; 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=Zj2FYOS2mu6dS/d9z6tl0fEgYLNWdM6O1P++FJ5PK0I=; b=afc9ch9/K+l1ma9vYcN9yKvr6y1BXQ210r2snku0y8C9OMxcXBk+LyWs3EFWkR6Ajw1FF/ xuny6f/Jh9i9KG19WLkdfntZOGB4LEJaRQDoXQ5E+ZANL40fzOZuBQWkWQla6aI7Aks7eP RCb6/dVQFzszITv4AWkS9MVt1+hzz54= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1751985533; a=rsa-sha256; cv=none; b=nzd6wSiq9e3qSWus8AGZvBEmeMZMTEFJQrPxISb2FUNTrIAPsayUOCvHscto2tmt6vHCiv o3iE/IVZm6O3rRdLDGzB6W4pnJw6ewTnBLs72JBOYK+WaXDAvCrORBX1oi1I08LY+TopDO GAPKrMdQ/Ul0jU/9srC5yhf5ErKbB8w= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=yzBIZ9h3; spf=pass (imf13.hostedemail.com: domain of surenb@google.com designates 209.85.160.182 as permitted sender) smtp.mailfrom=surenb@google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-qt1-f182.google.com with SMTP id d75a77b69052e-4a7fc24ed5cso322311cf.1 for ; Tue, 08 Jul 2025 07:38:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1751985533; x=1752590333; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Zj2FYOS2mu6dS/d9z6tl0fEgYLNWdM6O1P++FJ5PK0I=; b=yzBIZ9h34VgVKBpR3/TdsM0fcOSSKcYUJ0bPlJsvl/UO7xuxtygcWw9KbGHSaw3cq5 7dZsTzavV1PXwxa4wjClVYNugGK6bp+hFB0DHPf1MDKesBeNm0TRH/jvTU3yOLjKkYGR SwArXBkkbOwLiw/3bj7UFDAjruOWH78Z6tTwA03KSfbK6ryaGy2xBCqwVI6GA0T22WkF LMJ83J3zU2UNsM5wUt95x0vcBsXp5CreiUsHKUe0pIh7NAA8m3sw1bTu0oraECzl7OsD OOHbWzBC7YYgkrZ3nzfSnDi0qU8MP8g4hkLiEg4qmj49AvSi/ba3UCU1cr/SyycKRd1n LtnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751985533; x=1752590333; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Zj2FYOS2mu6dS/d9z6tl0fEgYLNWdM6O1P++FJ5PK0I=; b=aqNzLETQDs4zVb0Gd6p3BLPNEw1Dlg5oFp55PkGb+S/47Ju9roXLjwWxztfH1hmuP+ 39m/vl1qXMmi9AycYXCkuv0h8hPYcGf+wjteVoa3VOrAq0V047JqT5FFfKXLyawN8OFo wVOB9vj8avN2cuwVj9G9d4/O7CCnwddokO0jBFMgz9az33V0WxVqesF1j2bsc8uHjPz2 Ui2mJ87g44PibMjYV7rmryF0bzkI4CSaYLcJNRDg/mAQtHKrrtk+EmcHS2GUP0msC/72 6oOciT1SnO59uxug8WYDYFKrEuIiNIWuSMmkQjnzL/P6dLZ6RRRsQ/P87wyBjsDveiY0 dcgg== X-Forwarded-Encrypted: i=1; AJvYcCVWoZNxfH3frJqp6PqdhJe+hOdqJACLjM61B3KTEIMgHyIoM8QUv0cO4vxOrSPU7Mp8mmmGhW7lBA==@kvack.org X-Gm-Message-State: AOJu0Yw/QfPEVeTkjZgk8YrCyyuBRsdns0vFN3IxKJ6+d9RzsDTC7Yff BJrR0X5BCSFPNM40VLmJCgC1ARY50nQxG6jTszFxtzm6lsKmGc7UpW1espuhyU1cCrkQxqCskQN XH4BNHDmktoua+ss5f6kSCkBdcINqGeAbgh1SadFf X-Gm-Gg: ASbGncs2WBdhdI6WdJ5ap+svIHcYjMe6mXrLdpBmH1YNnHvoniIy9vlaNKmtSFHf2iG /diZN7j9U+2b60uzsXtO34sAZ/aQbMi0Zo49fsOGI5QXSZ8Y7wMlK/6RbRrT5cj7a4ZedXqft9/ Cdxvduqf3ect/tzAWeAPMYDvpsATKMu8BTXlCkoKAkQ01UNYshxCRsulzCKeQ4aNoAAu3wEiyvl g== X-Google-Smtp-Source: AGHT+IGgWZZAP/SzSYvrCwzeoHbEB4gm8NC2NMuu0gYs3fjMF2drShIZEHOpNY5qjfW5k5BA1Brr9w8QC9awv+95wAQ= X-Received: by 2002:a05:622a:784c:b0:494:4aa0:ad5b with SMTP id d75a77b69052e-4a9d46b1046mr2141581cf.2.1751985532425; Tue, 08 Jul 2025 07:38:52 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Suren Baghdasaryan Date: Tue, 8 Jul 2025 07:38:40 -0700 X-Gm-Features: Ac12FXyn1hKAXxVuKsTTSCNR1C9lLj4D5GX1g3zV3ywT8c5-3t0Tud_y6p51B6M Message-ID: Subject: Re: [PATCH mm-next] alloc_tag: add total bytes allocation information To: Kent Overstreet Cc: Li Zetao , Peter Zijlstra , Ingo Molnar , Steven Rostedt , akpm@linux-foundation.org, linux-mm@kvack.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: D0E9220014 X-Stat-Signature: qpkskz4nh1j7kmiq7bx8hdka7pr16gre X-HE-Tag: 1751985533-253619 X-HE-Meta: U2FsdGVkX18SAe7NuUNe+qVaMH8e+Hpj776QjmLqUGGDiw0Xqv5U/eQGCL8gH877ZyLHr/oSwqfts5faMSt984SBQir5qyNSX4N64BBd3Iuq2R46FfGsITAOFQlH5eJrnnJBPs5E9dCHHTMs8Ekcji2l3JRae7UbdhQDVJGWub0Hk9YL97ZEnMRxjDtBgQDagQFD7j03c8JK73131UOfkyHECpRaEFTYL5pl3VephO794UmBEvbma3CNOYIX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u9PKQznahakWefW+3lgYKV2Xjsmo796Ph0pQ== 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 7, 2025 at 7:16=E2=80=AFPM Kent Overstreet wrote: > > On Mon, Jul 07, 2025 at 07:05:18PM -0700, Suren Baghdasaryan wrote: > > On Sun, Jul 6, 2025 at 8:21=E2=80=AFAM 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_p= reload > > > > > > 12848 22 lib/radix-tree.c:276 func:radix_tree_nod= e_alloc > > > > > > 300760 515 lib/radix-tree.c:253 func:radix_tree_nod= e_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 :) Why not just use what we already have? awk '{sum +=3D $1} END {print sum}' /proc/allocinfo