Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp823882rdb; Thu, 15 Feb 2024 17:28:01 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVcvrCXAE6hw10kZyOvvmgAmhplYmFUurlW60pEg1DCVGxs5iuwePooF1/bWOMYXcx8duZuB+pTIPaJaw7bDJD+4mFW4U0WsqT7U2MJoA== X-Google-Smtp-Source: AGHT+IEq6cMjCS8WDmSr/3eAwiMFBP36fKNT6gtA210ujVpegRyPValeiqVoR/o842HNSBLJo9OA X-Received: by 2002:aa7:ce03:0:b0:561:1917:eb9e with SMTP id d3-20020aa7ce03000000b005611917eb9emr2515698edv.35.1708046881234; Thu, 15 Feb 2024 17:28:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708046881; cv=pass; d=google.com; s=arc-20160816; b=WAaI+nLpUm9qVJ2RzUlv8IlFHkvkSiPekH4ZqO8+MiiJUct33XlqvGSwno1n2nOGbD muANVcHFBKowdHJnUM9CW0l3x33ImjVeu81IkvnNOs/AEdjRLeusJA4Pz79VaW68slA0 XJk86TP1PMw9AnNcibGFsndh9NHOz6HaWsin9oGVMaj1x0BfxYFymjq5sCTPRa1eRf39 pcc3mZBWhrGtjsCMLT3Skw3IVJQKy3NSZYJSnxIxohZbY4C9xD1Q9S5+0nZ7FRiVYltG J1Qp5jqy+0nM/4UeFQC6LHj7ElHPqBwIwnlnPwQPUqF1zkQIWqv/uFBsQFqcNW0xrpvK 02HA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:dkim-signature:date; bh=eetpFPzcLKuw5HxOpWYVmhh5wz1OkHFu3WKeFY7241g=; fh=AXAb/EIPldF8fTCz27UB9ek+BYwmfJdsNgI0w/L/dH8=; b=pX/fqdHOybPW5mAUmfKz2yibGOSN06ot3SjJIDrUUkinLWzno7WeG4eVbz6X6DzpB/ s2/kNf9xQoRmmeVl2SNRtVm6ZJjCoSqQl/0ES0S+1/76lct8EuVbEVNAeJEFdWQRKWfL O5q9ykAzSEHC7eU1iwqbzYoKj2JVOGkyC8D8UO8d0ks4njeXOS76GA4susoPrlJbZq3R 6/K00ElGD9pBZgL5XinfujqTOUz78lsry7jgCybHtcGUytIMZw7sFHU2uE7mVkHagl+f kg+Tu9kBivt7GTGQRZTlErl/R7ARqrxHNitHJCXc5tJt9P0uC6tugPvrIRt4GBysYxcd lj/w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=eikRcSiI; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-67944-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67944-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id r14-20020aa7da0e000000b00562c5248c3asi1171334eds.134.2024.02.15.17.28.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 17:28:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67944-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=eikRcSiI; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-67944-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67944-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 030CD1F250FE for ; Fri, 16 Feb 2024 01:28:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 31017DDDC; Fri, 16 Feb 2024 01:27:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="eikRcSiI" Received: from out-182.mta0.migadu.com (out-182.mta0.migadu.com [91.218.175.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8E8FAD299 for ; Fri, 16 Feb 2024 01:27:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708046868; cv=none; b=oBBHmXzz2gjEJJOwjnDpQWZjWSYOATnxzq9Vxjtbw+cFAc9E8h2N60/VxxY4DTiJtzGjhPuRwy6tWZ6L4C/F7e+atHCV1mi5IfyfXZ+AqU56FdEM9qwXkVMEBm+8l/Z55tNly4F3+qVPsEb3LCgHM3sS9L1UuCGlW1dns23T31Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708046868; c=relaxed/simple; bh=2oKO7VA3PoFchDCqL7KpfExW+/KPmg7jqfIF2Vuf9TQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ZuBWtWEl3iInH4XkGcveGV4JGph7Upu/qFATzguQPbO2UKC1dSdWt7akNSJ6vRKRfvaZe3lh1952Uf4OQrJUvEVRG+wvW42Cs1/ZiVfU9N82SV8muCU6oNrgzKas1BLlXzXhDPElj4/tPIE8b7HeSSM42tvDatwfGKG88lVM/ek= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=eikRcSiI; arc=none smtp.client-ip=91.218.175.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Date: Thu, 15 Feb 2024 20:27:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1708046863; 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=eetpFPzcLKuw5HxOpWYVmhh5wz1OkHFu3WKeFY7241g=; b=eikRcSiIlxJQoaLSe+2OYMExnYsOjBZ9AUpmDf2rLIL/Q/zgYknGLLmlbY+KHrXhdQJyXa 4s4NUYFAxjJDTXRvs8jDGA9ZRJ1Xl781WswYHby5Zd9fsMN57an2WOSUwRYNvGe6uJPWh3 lr3fAX/rJ/8V61hf1ztLpHxf+bwctRo= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: Pasha Tatashin 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 Subject: Re: [PATCH v3 13/35] lib: add allocation tagging support for memory allocation profiling Message-ID: References: <20240212213922.783301-1-surenb@google.com> <20240212213922.783301-14-surenb@google.com> <20240215165438.cd4f849b291c9689a19ba505@linux-foundation.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 On Thu, Feb 15, 2024 at 08:22:44PM -0500, Pasha Tatashin wrote: > On Thu, Feb 15, 2024 at 8:00 PM 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:_kmalloc_order > > > > + 5.09MiB mm/memcontrol.c:2814 module:memcontrol func:alloc_slab_obj_exts > > > > + 4.54MiB mm/page_alloc.c:5777 module:page_alloc func:alloc_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 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. 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...