Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp974758rdb; Fri, 16 Feb 2024 01:02:59 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVKTYvRJZ3bD0OSF/6bJl6IB7eGuWt1y/YOXEUtPWwkm+jSza4H3R3XvehUHH+Mvn7ihWjjm75tHh6V9hrWAXqPeXJbA/ZsG38FWg/7dw== X-Google-Smtp-Source: AGHT+IGrYSDOnJUmzWs6cdoF6ycvIFrJpBXGdSMn+N0wjnr9nSYJ1j9s/yLWXVTpOyXJ9ZZsxyYj X-Received: by 2002:a05:6871:823:b0:21a:46a6:b069 with SMTP id q35-20020a056871082300b0021a46a6b069mr5199556oap.14.1708074178985; Fri, 16 Feb 2024 01:02:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708074178; cv=pass; d=google.com; s=arc-20160816; b=uoi3C8rWQExFOWAy/Ex+mXbvxbOUzLx2vCpJSb6fKKn6q5GqCLkvn+iy9JbdXFxg9W Evd1pMio9h+rlye7SQHofQybgvJPwlN1XEe7a2IaGeigdjeL+KJ1lO5NoH/pWIa0WLdD GG3tTR5EluayKg0gguldeLJ9/ZOTBk96kQmYkj0eDmaIBU0d2JrfIU24YyYL+7+G8KlZ jqMSprC9avM2zIqVYsZ4L2GdA2oO+LhuODNXOUnpJAEIHulNBmADAji8C/2LBYMVPpBt pjbyAF1sNsdLszshygL1Jy0XakxPonGgmOt0HQnApf1epnPHxPaJYN6kSIV1LRO8z+2P ipZw== 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=aC0zV0jURwgzq9Q6615BgsaS7tbK8PR71BWfZKB9Bg0=; fh=g2UxcTnsgk4sCVF5qWQxrP3Qu5TO8lhZdhFXZ+qFQls=; b=euQRDHOwZBnQ9E/Uf3UHstI+IUWiirRvX0SBpn+FZF+L4hnnNfvdFisbGIQwmtXyJt ARWCOxb8Pw+MdJ4zU3dLcNdcg9WAYimtyiy3gz8S5w7naKsynWEJbcaqMqQ2jEWJjYxC 0C3BqW1+hXm4wBdH4oOk3ljSACcOxOdQw4wdvADo/H7+Gaj8pXFxTmWnEMvYrOZqYUUO 2pMO2fd/9jPE3+07LH46oaVD9h2i+MRKmsemep25v955j+RIx0GfVBJz6xMpweEbOewx q8W/adVWA0XWKYEfC7OEmYeah8AwP6ReR9Ugj5swdHXiMCVZGiETB32egdRumekgRDGs +A+w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=Aa4qGi5k; 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-68298-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68298-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. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id a20-20020a637f14000000b005d81875c4cfsi2670906pgd.882.2024.02.16.01.02.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 01:02:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-68298-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=Aa4qGi5k; 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-68298-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68298-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 A4AE128AD24 for ; Fri, 16 Feb 2024 09:02:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BA8CA1B95D; Fri, 16 Feb 2024 09:02:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Aa4qGi5k" Received: from mail-yb1-f176.google.com (mail-yb1-f176.google.com [209.85.219.176]) (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 0E20D1B80B for ; Fri, 16 Feb 2024 09:02:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708074159; cv=none; b=Gv4eK7wfhKvLnC0FI/aoEEutoj+ug9OCwjIIsJ0HKrP6qvPuxI2TGYFNq0nrqr+s002gEpzD38p/lI639YVxsj0Zb0LkGar+u1jrVTryLoh3VRSl+KmHiRsr+FS8ldiSSxE32zPj7f6AkUQ7ZyiEQMmBI+4IjN4kvcl1a7wV6N0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708074159; c=relaxed/simple; bh=0ASL8/2Fnq0OuCZD8H09gdyT0FLFuomqfwj8h+QBwB4=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=GPCC4F9Gzn3DdMECBbixUv3zW4Xd72lfts2mC+15CfnCunXJdGpWBNcLt7UzFs553rTC+uJhJzFWFnjL9zWLcaVQwrjox51oa3MScAU2823JsqHsUHkPLQv/VTzAX+9u1k28ixNGH4QxCahaiNQTr60eI/whPbOHANFd8EgPlmw= 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=Aa4qGi5k; arc=none smtp.client-ip=209.85.219.176 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-f176.google.com with SMTP id 3f1490d57ef6-dc6d9a8815fso1914980276.3 for ; Fri, 16 Feb 2024 01:02:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708074157; x=1708678957; 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=aC0zV0jURwgzq9Q6615BgsaS7tbK8PR71BWfZKB9Bg0=; b=Aa4qGi5ko2WzUV+jH6oa9oWrZHue0INtEQodKMwZR6oy3qFY32F7/uf0Ro+Qike6sh m5ajjY6rF0LavNZfRoy2p4RP/PP1yXtuX02ypA0PYGfHpLaoabIdf3fLcHrkvvhjnohg cjOItnTUFyF6XUMwzZDvwCA+D+cO0ZTrAuRhhJUadlOBRhCob4rMzccgQxIMvl7WlSKn tgf2qKEgQ4I715/ta689QJRUTChZE6GR2DEoP4DyerGfEN+Csa1egLgGeWs2xjVX7w3j zp/InkjOkfMB1PKGN9U7ay33MxCloKc3paseNzbzkPHhO5dZzXoyZ2Aal+jL6PSesebg wgmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708074157; x=1708678957; 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=aC0zV0jURwgzq9Q6615BgsaS7tbK8PR71BWfZKB9Bg0=; b=IBCx+9OrDodx+LITn6KIsUznMfTKkuqykTZHkDHta5ZgD78ieUkGEocptlqpVT8t7C +KO9r0OZIIFfu9zR1UFr3uSI2wWlc0+3NqrcwHuWHSwf586q7U5f/cP6v56OeMudbqpO dImnbDjVMUgsnPssYfbFaggtfkmXGIZyx1OYs0nXSiM4XuOQELgpdn3ch7sEwVYmzNyp 8g6sbTD4YmC6kwivYVGFBUaO68OlZgQqphOwG70HOed0beOmJrvp/ja0dZ0jzIuubcKs EwonWhj/rAl2pBSr58B0hSMt0QpmiTCYfnOnSqoBPwcaVNZUtohuHDyfVxnYyM/c3VZa QeJw== X-Forwarded-Encrypted: i=1; AJvYcCVVwYDgyWnM2edNEeyQbXYRV3l4vQWcezy0GTJogKIMJ2WoHxuywuAO++Qs9QCCED/t28OdBiYNfyoZYfXyxyuGhA9/9hxW39s2Ok4K X-Gm-Message-State: AOJu0YxzbxMC7t5GZvsN1BXpvNL0xLZTsFc9MolAXmQ1b7ti6K/6/bI7 euYu6SJA1AKa+y83ByvaLCn5qm6WKwKsCrbjpS2wa3omrpPZ8G8PwNQi4U5AtPz0FL42jQKRSfn 91HZBJpeaAwDckQSPVNuel5IbM621v6sjlnxY X-Received: by 2002:a05:6902:1b85:b0:dc6:421a:3024 with SMTP id ei5-20020a0569021b8500b00dc6421a3024mr5156888ybb.43.1708074156727; Fri, 16 Feb 2024 01:02:36 -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:02:25 -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 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_page > > > > > + 6.08MiB mm/slab_common.c:950 module:slab_common func:_k= malloc_order > > > > > + 5.09MiB mm/memcontrol.c:2814 module:memcontrol func:all= oc_slab_obj_exts > > > > > + 4.54MiB mm/page_alloc.c:5777 module:page_alloc func:all= oc_pages_exact > > > > > + 1.32MiB include/asm-generic/pgalloc.h:63 module:pgtable= func:__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 specifica= lly > > > 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 dat= a 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 b= e > > > > 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. > > 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?: 160432128 (153MiB) mm/slub.c:1826 module:slub func:alloc_slab_page