Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp822293rdb; Thu, 15 Feb 2024 17:23:36 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW1gX++m1A4EZRBjrz0plGp36gUtPph7uL4mWNG6S8DdjFYx+e0Um2zR5vDWqB69bsJ+3yMY0mOxt45I9RTqGwTM7bo7unmvNP5hNd0eA== X-Google-Smtp-Source: AGHT+IFxdjBn1Ppjp1OVdtf+dwcum0wd4UNGhLPcHUnglxpK09sqJhZSt3eV890jNcpawv0zgpgH X-Received: by 2002:a05:6214:4103:b0:68f:262:df10 with SMTP id kc3-20020a056214410300b0068f0262df10mr4654878qvb.53.1708046616305; Thu, 15 Feb 2024 17:23:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708046616; cv=pass; d=google.com; s=arc-20160816; b=qYm3vv2qaqeJb2yrxwM6iL5mEO1YFK1rWiQiAaI4lZ2T6X5FVtLt7iETKx9L40BWb+ VZoqwAGPCYm6K0er8YVuVjuHDY50aWSGtoY9WwBnbzoRyDVYB9kI2DVn/hk7OyMCQ6DR 4GDCseGtYti0MPjoXy0uP+4Ls0BshmB1BeLKR6yThPxCST0pmIqcz/69GEN87r0kYmOA 6XfNWxMbkeqAZF4ETT/sH5uGjIsloMtA13gtHk1qlJ0dAyFyuqhlFUXtt25ybMtrKCV2 i3aYFFDS4j5NbFdOvE9EKznf1gvhpWeOzCZHqsJTRrmAHJPhZ4XDOZ2Ldu9SKG3s8o62 dv6A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=eLBxcB96LUnXdvE3EMMcNpcL8B6icUkLMA8zN7Nwyj8=; fh=sZvJTcIWOpf7h2rSYFYsJsvOGOU/vJlyD2NWUoBLT/0=; b=Se/k53BoVbMHIBtS5QyThvBsTXAuY5BQvERvThfWDLpApFvdGB5KiOWQG3M+plAh+l FOXtw/6z0/CKKkAgtLyyEg66kUK5eFvrzNxAMUKEmlijHnsqTOnPYZ+0M+yj+6/bmNdD 9pZO2ddBfoEpwSDYGY0e74pjpX7xMA+pxDljhZS/vcjoVfiURnfbr0rBfzmENlBhRvQF G/1BYPC+Sfhhuj2BsxRwXblJpDjk2M6y7tWtQgn9/iDonS9xS1kmgfo3nHkxtsF1VrEA SqmZvACnh2UPh0vK036sOsf6pSapNgz7HCy0RHrZP6hA9s5KFnE53n2tlD1ulGy73rqb /YZA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@soleen-com.20230601.gappssmtp.com header.s=20230601 header.b=bnq5wUUQ; arc=pass (i=1 spf=pass spfdomain=soleen.com dkim=pass dkdomain=soleen-com.20230601.gappssmtp.com dmarc=pass fromdomain=soleen.com); spf=pass (google.com: domain of linux-kernel+bounces-67941-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67941-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=soleen.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id fo9-20020ad45f09000000b0068f12889eb1si2810620qvb.387.2024.02.15.17.23.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 17:23:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67941-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@soleen-com.20230601.gappssmtp.com header.s=20230601 header.b=bnq5wUUQ; arc=pass (i=1 spf=pass spfdomain=soleen.com dkim=pass dkdomain=soleen-com.20230601.gappssmtp.com dmarc=pass fromdomain=soleen.com); spf=pass (google.com: domain of linux-kernel+bounces-67941-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67941-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=soleen.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 061501C212F2 for ; Fri, 16 Feb 2024 01:23:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 211E6DDDC; Fri, 16 Feb 2024 01:23:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=soleen-com.20230601.gappssmtp.com header.i=@soleen-com.20230601.gappssmtp.com header.b="bnq5wUUQ" Received: from mail-qt1-f175.google.com (mail-qt1-f175.google.com [209.85.160.175]) (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 6A18C944E for ; Fri, 16 Feb 2024 01:23:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708046604; cv=none; b=mprBZdr0vftwciLE4LNzy4pLUSW5Do3kUCsvQiEZgwOtdFIv9ZfNRjtU6XPp++emY3hBv9e2o7/cJK+ymALbJVBf8IbaYCqVF27t5UxzCM29cc/Fu7d5t3OvRfiFTS1d0zS+hobqT7s8SM5p+PB8jz1EDhV/Gn5nWroUhDM2iQs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708046604; c=relaxed/simple; bh=yOv4lCsMlL/EKUXCC4Ma+3szviWFRNJ0I0zqeqBfOVY=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=KGOD0m9s8y1WNpyVA60FPdFqgWLJkv5haVsCxb29dMJEvI11iSg80+vFum0/mQryJjDT4NCGD8mG+pptCwiOUqsiR5PN0sldO1w8u3eDK7xeTSESboH9NbhU5xRv09lig0xBVkLxEkC/rwnKrYRYiNeCMrwYXUj7AzqO46+3OdY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=soleen.com; spf=pass smtp.mailfrom=soleen.com; dkim=pass (2048-bit key) header.d=soleen-com.20230601.gappssmtp.com header.i=@soleen-com.20230601.gappssmtp.com header.b=bnq5wUUQ; arc=none smtp.client-ip=209.85.160.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=soleen.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=soleen.com Received: by mail-qt1-f175.google.com with SMTP id d75a77b69052e-42a9c21f9ecso7635241cf.0 for ; Thu, 15 Feb 2024 17:23:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen-com.20230601.gappssmtp.com; s=20230601; t=1708046601; x=1708651401; darn=vger.kernel.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=eLBxcB96LUnXdvE3EMMcNpcL8B6icUkLMA8zN7Nwyj8=; b=bnq5wUUQgCVZaEihoESdR94jM+VcbO/HpJnNeAOc0f2OI9uvp9qPHfGPkyDP5SgR4L jpb96hY6UPoxWRwnk7y7Ci1sezowXkn6flGMK3r/B2KO2XRdBZXdMd1qLUSX5GR2EsLP ERSo6plK8hnIbVY6+wIWyHqtvzKAU/w0GM5BnJ7i3Kcz/L/7XgKMEgOIuZDdzkXui8JN GuPuhvIolgpUv4mOPqAIeOqvG1Yg6p0VSD8L2QRF204ArpO1TOCg5hWmzF40dU4psVp4 TTh9NHWgZR2S5Tdo/1RNQLZLGdCKwAT0+Z7mi/SbMCjlcS1d9GQatrJSaTvRJLE/dOF9 JLNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708046601; x=1708651401; 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=eLBxcB96LUnXdvE3EMMcNpcL8B6icUkLMA8zN7Nwyj8=; b=IqokCsLFMg00xvAUCA93S9u85V26JvDJcwcnxt710hVvsLjhWZwOwHwoR602daIhRS A2AG/KfLw0Um6Ks1AFPcug7SPRf414JmM8IEv/SdVPMMvKjLpabK4lEEppicpJSeCxv2 k64pgZLBHaXxWIMsl9bMs8hoeCLi99Yv4kNsJ5fD4kh7NEqbW8A/DvjWqdVJu8+tFX/B 9lv+4X1/ASGUO++2ggpYpcd8c/7ZPzbr0G0hZiThCicXUEp85qOy3gzUpcz/uOgTjMlj 9ZNWr1Yh0EzC5HU3wyu0J+B+xB4RmHAJCz/D9NREtA8jdO48Myx8dpdyVFAFAtiJzMx/ Yh1Q== X-Forwarded-Encrypted: i=1; AJvYcCVP452xlckCDOeJUN7RassoVNsq00yVbzADciRiyhCW/E6ae8hYwVCkcfgPTsKoPIZqv15Rn3ORflkAQ+WrWM/Ml0MLPG2h4U7vMHzK X-Gm-Message-State: AOJu0Yy0NURHh7M3tG1vQ4slUPz2QejhKme8LvTLNXuCcT+oliVZzcsd sYobO4NCpnT4dajfOAm6DCGogyPuaH6MHxvJkPSslRreUz4E4TlsWR9THXoK7+WY+wYGcYc94d5 MIByVkOB+HJV1KryJRMPhEb9rhsCvJfhNJzyoJg== X-Received: by 2002:a05:622a:1a94:b0:42a:48bc:f69 with SMTP id s20-20020a05622a1a9400b0042a48bc0f69mr4538976qtc.35.1708046601368; Thu, 15 Feb 2024 17:23:21 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240212213922.783301-1-surenb@google.com> <20240212213922.783301-14-surenb@google.com> <20240215165438.cd4f849b291c9689a19ba505@linux-foundation.org> In-Reply-To: From: Pasha Tatashin Date: Thu, 15 Feb 2024 20:22:44 -0500 Message-ID: Subject: Re: [PATCH v3 13/35] lib: add allocation tagging support for memory allocation profiling To: Kent Overstreet Cc: Andrew Morton , Suren Baghdasaryan , mhocko@suse.com, vbabka@suse.cz, hannes@cmpxchg.org, roman.gushchin@linux.dev, mgorman@suse.de, dave@stgolabs.net, willy@infradead.org, liam.howlett@oracle.com, corbet@lwn.net, void@manifault.com, peterz@infradead.org, juri.lelli@redhat.com, catalin.marinas@arm.com, will@kernel.org, arnd@arndb.de, tglx@linutronix.de, mingo@redhat.com, dave.hansen@linux.intel.com, x86@kernel.org, peterx@redhat.com, david@redhat.com, axboe@kernel.dk, mcgrof@kernel.org, masahiroy@kernel.org, nathan@kernel.org, dennis@kernel.org, tj@kernel.org, muchun.song@linux.dev, rppt@kernel.org, paulmck@kernel.org, yosryahmed@google.com, yuzhao@google.com, dhowells@redhat.com, hughd@google.com, andreyknvl@gmail.com, keescook@chromium.org, ndesaulniers@google.com, vvvvvv@google.com, gregkh@linuxfoundation.org, ebiggers@google.com, ytcoode@gmail.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, bristot@redhat.com, vschneid@redhat.com, cl@linux.com, penberg@kernel.org, iamjoonsoo.kim@lge.com, 42.hyeyoo@gmail.com, glider@google.com, elver@google.com, dvyukov@google.com, shakeelb@google.com, songmuchun@bytedance.com, jbaron@akamai.com, rientjes@google.com, minchan@google.com, kaleshsingh@google.com, kernel-team@android.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, iommu@lists.linux.dev, linux-arch@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-modules@vger.kernel.org, kasan-dev@googlegroups.com, cgroups@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Feb 15, 2024 at 8:00=E2=80=AFPM Kent Overstreet wrote: > > On Thu, Feb 15, 2024 at 04:54:38PM -0800, Andrew Morton wrote: > > On Mon, 12 Feb 2024 13:38:59 -0800 Suren Baghdasaryan wrote: > > > > > +Example output. > > > + > > > +:: > > > + > > > + > cat /proc/allocinfo > > > + > > > + 153MiB mm/slub.c:1826 module:slub func:alloc_slab_page > > > + 6.08MiB mm/slab_common.c:950 module:slab_common func:_kmall= oc_order > > > + 5.09MiB mm/memcontrol.c:2814 module:memcontrol func:alloc_s= lab_obj_exts > > > + 4.54MiB mm/page_alloc.c:5777 module:page_alloc func:alloc_p= ages_exact > > > + 1.32MiB include/asm-generic/pgalloc.h:63 module:pgtable fun= c:__pte_alloc_one > > > > I don't really like the fancy MiB stuff. Wouldn't it be better to just > > present the amount of memory in plain old bytes, so people can use sort > > -n on it? > > They can use sort -h on it; the string_get_size() patch was specifically > so that we could make the output compatible with sort -h > > > And it's easier to tell big-from-small at a glance because > > big has more digits. > > > > Also, the first thing any sort of downstream processing of this data is > > going to have to do is to convert the fancified output back into > > plain-old-bytes. So why not just emit plain-old-bytes? > > > > If someone wants the fancy output (and nobody does) then that can be > > done in userspace. > > I like simpler, more discoverable tools; e.g. we've got a bunch of > interesting stuff in scripts/ but it doesn't get used nearly as much - > not as accessible as cat'ing a file, definitely not going to be > installed by default. I also prefer plain bytes instead of MiB. A driver developer that wants to verify up-to the byte allocations for a new data structure that they added is going to be disappointed by the rounded MiB numbers. The data contained in this file is not consumable without at least "sort -h -r", so why not just output bytes instead? There is /proc/slabinfo and there is a slabtop tool. For raw /proc/allocinfo we can create an alloctop tool that would parse, sort and show data in human readable format based on various criteria. We should also add at the top of this file "allocinfo - version: 1.0", to allow future extensions (i.e. column for proc name). Pasha