Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp975358rdb; Fri, 16 Feb 2024 01:04:09 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXBXJrykcn66FKpHtJKaUbLWG2Jk3ShTQHdUObn4F10hJkze+u0zsUVvXd9EbHrfF6RMPxenvv8ejDbQYRghfx8xQrw3qrrzYETTlOJ7Q== X-Google-Smtp-Source: AGHT+IHDBroBWuTgU8fKyM1OjdYTnEFZOclhnANuGkEhg8hgHoDIL8SbAo+XPl5VkDyW/MF79n6f X-Received: by 2002:a17:90a:cc12:b0:299:2807:1eb1 with SMTP id b18-20020a17090acc1200b0029928071eb1mr3195099pju.34.1708074249440; Fri, 16 Feb 2024 01:04:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708074249; cv=pass; d=google.com; s=arc-20160816; b=Zo1aCiD5vCYUcRNwuqnReC47NckrIJVv9vFAmTb5m1bBg+T+eNJfspmp6U9Dp//Lgr myywVuZXW0Z/W1kFZhRSznCukgDA/Mj2G5bU04tGV7eBn6Zc6uMPyK2ov2q12gNuchTy IhlurbVzAYbrxgPnj5qp7eEYqN/KSHUFX2eW9oAsR1AivfegLxABcGzgWOoFuAPhAI1x hHCQsAATYc3ZrK7LyYX1pJYQVjHKjsLh7R4W3FjNeUi2LDa7wh8zpSmoOZa13nrRHf+O Zie2ItGv3O9bEm3uyfdaX/KLZpAQ35iCOeWBzgePLf2Tf5LmxXpEKStaFpycSIk47cnw 584A== 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=GIsEikU4izdqkDoN+ZKv97zMNiSEQemJahB5wDm74LU=; fh=t3manxjuMM7oCdVlN7qz1MzEPaLgkHu84BE1RvCR0sM=; b=qpRG/VdHElj8bZL3d7WUwuPjZzWE8U50AqEsz85B4d0iAz6FeQT15b5LK3REWWWX0C gHEzemCWiHdHKQogbt6qgnFhfsGfaj36rUvF122R74KETnCeTZuwhmt2Gwvz4mx34k1S NqpAWbqE3mq+G//NRCuZNCFfD0CnBD4RkrIJn+F1uHxsssnCR+cpdZ/uwjIcMf1t3Osh aXmthakqiypXwQrZ6ZMVYP/JjOki4WP9r8PzhBda6PtMiIcXA0KqeLkhFsCfQMw90RWb 2jWYroqdFI/BKrwd9aAyWBJh7+i1g7C0xO8CMAC1lyh0wDuuvga9yyAEIkSnvqr/hFsv FfHQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=2RZg1KAp; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-68300-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68300-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id il4-20020a17090b164400b0029934a0a452si894248pjb.78.2024.02.16.01.04.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 01:04:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-68300-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=2RZg1KAp; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-68300-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68300-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 23FBE28AD48 for ; Fri, 16 Feb 2024 09:04:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BBDE41BDCB; Fri, 16 Feb 2024 09:03:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="2RZg1KAp" Received: from mail-yb1-f177.google.com (mail-yb1-f177.google.com [209.85.219.177]) (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 C46EF1B972 for ; Fri, 16 Feb 2024 09:03:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708074217; cv=none; b=X2DVsSoegpdDM792saNkLzficpAI4IR4s1swuXCBtYAxBjAwDkOoCS7WNX5zlJkHEjJQBouZwq+xEJ6NWVxWeXwEHFhTn2tuXfZ6Zer2legwn0CBDNQLZDUDoJ7JPRez99kvxFvFugFiGpHpWmCeT7yP4vRVeiO3Ebegat0oVyk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708074217; c=relaxed/simple; bh=dkw5/IVhfZj5zs7Oe1iWKLQE3h839PLLeYTuwMZDLgM=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=q7NQd3rcrbzDys+vYGwQ33zRhvENT8XZfIDWzahNYrn37zhlToqnOgKfO6gzIW6ymRlS5odIJ1h4/OvhU5gSW9xVnhN27B3yyIgMgqjAWarHLNlj++kmVVWep7NpKwKt/QqNNqj269rgHD6vJoRTyjI4sYWxnF8qMb0DS0kC7SU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=2RZg1KAp; arc=none smtp.client-ip=209.85.219.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-yb1-f177.google.com with SMTP id 3f1490d57ef6-dcc86086c9fso1815038276.3 for ; Fri, 16 Feb 2024 01:03:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708074215; x=1708679015; 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=GIsEikU4izdqkDoN+ZKv97zMNiSEQemJahB5wDm74LU=; b=2RZg1KApnj84nHSlLVc2ycT5QOJVaBNgiKZM04mw2rYJ+dHzqmQIvADP5iUlzJ9/yK efgpsIJ9a3h0Wf04i0V99FO+5BESARCJSjnrnF5mRyd3LAPn/N/EV63r7WHu8VAUopFy /xVET4gcr5k9GO4TXksAfX2s2OZjhvzYCtGsxRbCm9+knPX9AHOSlELdDysXodtDIe5Z 3yxTO7ETynRqPcuSbbaZSQiXKGac7pDYmxSAX08LkQZwj06a+dMyX0LpgmM3WoZNjD+5 LW1GNS5DRJuwXZob9VEhtSKjJy5wHha0aEx5j75PWx5m1ft19/Ke/LgFplw+qS4Wxy8F Vd9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708074215; x=1708679015; 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=GIsEikU4izdqkDoN+ZKv97zMNiSEQemJahB5wDm74LU=; b=tCPJ8SaZoKQQwgz4eHir/rNTLG8LXlnIN4MuESJcL/JQUEMtyE8km1YJW1N9gmy9LN 92bE2hQ1M1UoT1bPJYVMxnw0y7SSMI2cHd9HqGcQXytjcHDXKeeB+JE/vXCsTo9y6eKy rV9fiDqfTsjmI6D8vl15z+wzviT4my65p74ByDUfrKwGy8g+az94XYNFEi80WsuBdrXy n55vjhU8PnfvHkWj3+kjxJVvEzqEFfZ8dkWC4qbhWaId5dXLNf+QtupUVcsQ/UjxHXbo wJMPhdXIzOubc9savdDWDXJt403GfWNb+lltcTcuFct73cO4faHPuPqn9OKqh5Ko5SoC U7GQ== X-Forwarded-Encrypted: i=1; AJvYcCVJGdwdh6sdGddS01yx66tBQuJp/WrnzmxOOCww/38+ABTq51FebY+jWFMwQ5WtSXgwtdwx0drmbWK9Rp/Mdxoch7xlX4xusPtA+65W X-Gm-Message-State: AOJu0YzSipyROcqOhMFL4ju74vJbzg9EiZKqnmwa8V6Qk45PrArLLy9W Xnd8bYVYSucIDWEu7VxC/rTmEhHzdkt6T74v2D+NJyIm7YbsB3YKmJ+xi2eW2/IVlfpQICNs6MU qb5c9FXaN76qCL6ElMGp0LSjtRCLCjc/fHauS X-Received: by 2002:a05:6902:200b:b0:dcb:be59:25e1 with SMTP id dh11-20020a056902200b00b00dcbbe5925e1mr5215694ybb.30.1708074214367; Fri, 16 Feb 2024 01:03:34 -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: Suren Baghdasaryan Date: Fri, 16 Feb 2024 01:03:22 -0800 Message-ID: Subject: Re: [PATCH v3 13/35] lib: add allocation tagging support for memory allocation profiling To: Kent Overstreet Cc: Pasha Tatashin , Andrew Morton , 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 Fri, Feb 16, 2024 at 1:02=E2=80=AFAM Suren Baghdasaryan wrote: > > On Thu, Feb 15, 2024 at 5:27=E2=80=AFPM Kent Overstreet > wrote: > > > > On Thu, Feb 15, 2024 at 08:22:44PM -0500, Pasha Tatashin wrote: > > > 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_pa= ge > > > > > > + 6.08MiB mm/slab_common.c:950 module:slab_common func:= _kmalloc_order > > > > > > + 5.09MiB mm/memcontrol.c:2814 module:memcontrol func:a= lloc_slab_obj_exts > > > > > > + 4.54MiB mm/page_alloc.c:5777 module:page_alloc func:a= lloc_pages_exact > > > > > > + 1.32MiB include/asm-generic/pgalloc.h:63 module:pgtab= le func:__pte_alloc_one > > > > > > > > > > I don't really like the fancy MiB stuff. Wouldn't it be better t= o just > > > > > present the amount of memory in plain old bytes, so people can us= e sort > > > > > -n on it? > > > > > > > > They can use sort -h on it; the string_get_size() patch was specifi= cally > > > > 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 d= ata 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 muc= h - > > > > 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. > > > > That's a fair point. > > > > > 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). > > > > How would we feel about exposing two different versions in /proc? It > > should be a pretty minimal addition to .text. > > > > Personally, I hate trying to count long strings digits by eyeball... > > Maybe something like this work for everyone then?: s/work/would work making too many mistakes. time for bed... > > 160432128 (153MiB) mm/slub.c:1826 module:slub func:alloc_slab_page