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 7BB72C48260 for ; Fri, 16 Feb 2024 09:03:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0993B8D0001; Fri, 16 Feb 2024 04:03:38 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 048D96B0093; Fri, 16 Feb 2024 04:03:37 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E035B8D0001; Fri, 16 Feb 2024 04:03:37 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id C953C6B0092 for ; Fri, 16 Feb 2024 04:03:37 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 9A1578038C for ; Fri, 16 Feb 2024 09:03:37 +0000 (UTC) X-FDA: 81797078874.25.8C8B65C Received: from mail-yb1-f181.google.com (mail-yb1-f181.google.com [209.85.219.181]) by imf18.hostedemail.com (Postfix) with ESMTP id B397C1C001F for ; Fri, 16 Feb 2024 09:03:35 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=RiFq1cfw; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf18.hostedemail.com: domain of surenb@google.com designates 209.85.219.181 as permitted sender) smtp.mailfrom=surenb@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708074215; 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=GIsEikU4izdqkDoN+ZKv97zMNiSEQemJahB5wDm74LU=; b=tn0igcGdeg3Nh4mV/kNAWqa7f3Cz26V4+hJ1iehWcfxZFvS28bl4+uWuYsxjjvk3kPa8uW vCsXaJM3o0LSHh9KWbV1P8dpCjn6p/cAq+a+p26DIJpBNYlIQzl3gLNyBZlp90ZJvgJDzh co/yCAp0FM520I+B/AL6VWHFk3B5jn0= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=RiFq1cfw; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf18.hostedemail.com: domain of surenb@google.com designates 209.85.219.181 as permitted sender) smtp.mailfrom=surenb@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708074215; a=rsa-sha256; cv=none; b=PBbFIAkA2U/tdbg79nXZ/rL9XYtt34fcyQeWR7CZd6qAyXv3xpjoy6jpipLxigIZBEeCZm gpiGupBI851v2dc/XgYwQmoPBCh3gifA2e6ansQJ+c85enSjOvH+fsIUPA5Uz4/b4huV4J Si9V/Dvt2kYuPMpeX3FfDdj6dLLB/lY= Received: by mail-yb1-f181.google.com with SMTP id 3f1490d57ef6-dc238cb1b17so1697443276.0 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=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=GIsEikU4izdqkDoN+ZKv97zMNiSEQemJahB5wDm74LU=; b=RiFq1cfwvsz69LXoD/qdn22u/o57YV0hQu3CUdnoeywufLJcxRR3pXbi+KHJxp14HD At6J8mM2t9YWqWOeRyVI4RUnMYORuXTEA0MnLxEbyIhQbcqQi5R5zyH3h314zx9EPccH 6o/S9VXU2uuU0Bm0crJs4En4Cx0go2R9/ptkvNaOBttLewD7mgNpHP73JlgOfhiBn3Fa 8Z+51G66WE+7Psrxy5TBh3iYM5t54ZytTnlo/VPW5Fc0O4kVDKrTjQrUwrnMS5E2x4r/ lAsFuejcdMViUEaxFFYDv7kZf87CuBYAO869bpGGM4LZLtmVFzlQ481t0nRpHUDJa9pO K6Mw== 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=AbzpLZzOdye3l7pzRxsXLO0awk8mO7B+x2V5Rr79gKXebRDkCNOeMV51Wk8wjSuRtw MuRL18cERnWOrfn4veIJbWGAU+eh9HOpic0ghxFDpGmRtQo4yodFAPUMEHk3fvWU/UAw 2mCdDbzepIRE3l85OquFxFJLoY59KiA6uoFPvi2B3IU2h9dHNUOiwX//ev95BmDiiBt1 aBPphLuG2eU5tmGr9V0pdj8siiE+a9QkO+3LGBnzaQ5MNbRhwtvo75wc6IVuhHsy4Qoh VQedl3Hsm7XOkGX/hmOk28Gf3MuXiptCsMlfYXY0RXVqvSQRhsLhClqRzRcQCfBKUOtW ekFA== X-Forwarded-Encrypted: i=1; AJvYcCUSZDmYslQ4vqvY50CkTeEA+OfCAB+2XzHQ4C1JQ0ooKS+eQDXYz4m3bqVLKAqJ+s9ffiQjV2lKtokBFrvdz0RHHp8= X-Gm-Message-State: AOJu0YzxSxWPQRJg4hRglWHrrB91mqY51C7UGIyss0NsWvqm2GXeQJrq Q36tyE8nh3yH2Z3j6Rn1BIDrYBgpPzwBgETMPBKe2IrtAxaGNvPfJMvakDC0B3szmdA360/pw61 SQDLdhc0przVYlJ6IUSA632kHVnSj+WYeeS2y X-Google-Smtp-Source: AGHT+IE8IHpuOe2beld9vVWKFUEkUtO+/3eNyPe5KrBlxSBI4QdK9EveZ1I5XPH056j0G4IXvvphLveaFK0jjo4oCok= 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) 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 X-Rspamd-Queue-Id: B397C1C001F X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: t78spaufqhde14jan6myrbxx47nsum8f X-HE-Tag: 1708074215-222708 X-HE-Meta: U2FsdGVkX1/kXkMISSecKrZ9ERZwR5XOq3JguZSUSBmrZ0izL/sC50cPbLUY4s6JcM4YwctvUtoN8V43vYGnYudaC7Fpvgvpb6R9DwZJ9WmWe3wmCjbsy5gr4hOqbGB4tI8nbH8uJg1Mamd1TA3rf+aXdpqJww8qjXzBC9U2yYjL7iLqojzc0VSxCxh0cZU7Qt6HJ/Qfjnne4lYfsNmpi6jsb5sRJUmJAsVFxWF+VhkJpb3rUNcZmog0NT/o5umaKRY5IgckzNnLHhKZp9XhB0IbWolTwfnuNbXdVlTfrzlmfpeUkZpkN8j9uGTA2VRTELGtSmYKv0NJacKCwR30LwLX9+5hj4JE6/uWpeyBx/dP/FAepoKo3T+qlcgF8CRzEbr1VZrz0B+9Me9ZLQMvLz9voPw0/WFGmX/EPkXcXpnaI6wZLUzTrGsdmVfIKjvnBZ4ttEnq+xKiqpXaJnk94fWzSo5gBBexTyFAGEDFBO0qkXJTKrt1Io2bJz2zxAuPdpNP0eKtSr6hff206gJyuR3RmndZP+BeQuzwlAEpVnR/kMmrDv+LBB641zIleJwIw40EH3MJAgRxsWmeieWqd4CbXlpJTOVzu08D7PrDAD0rFSAdz8zdBmiSj+7qMSwq8uM5YnvMo4Hrv2L/MNWq0vuzy6TNNYyEadZxxiV/MtPl7nck+vL9AUA07Pzyf5OAC0OaW0EOwvsU79UCd67egOM1SjHLkPLiW/vgkTIFAJ8y8XfV85pTtQdM/vPst/AlbeCha8VOgYKoJ6RMxGvbs83ZzVfskeuBt5kA/7cnl26KV6F2wR82LT+gtJwlYvE4htsi1IQr8mEoyDBxitGK8mKdW6C9LAjEU4QVSBw4qQDWXXoWgbI2FM3Bt79z2oaCK1jy/p8er1dfWfseu5TkUcxtF0OPADidADFoMs+3OpKgkNHkGoNOjuiCnT4vgTa4+ZPZvi4Z6rHRfUJL35g nSDxSKfA YtnfCLTY7bnQ50wOF5vQy+zkS0AZ7BxYac50Y7b9ZoL/Ei6/OBtmwnVSPtUsQn51tl23k8MDwNdo/k0MpFUOB3Emc+d3kvjDNZ/CErZiNgjfUgG0k7F/r4E1QzACFDJ+4kHhYk94s4es8cChW7vptGPoMZQYLgTiDaTJGyfZ1ZO8wtn5uFyx9l6fzCXl2sVZk0PaJBGQ83BN9234uJZj+8DjIyWcauXxSakk0s363mTd2JS/zVr4/78rTRz/mZ6RtUo3X4MrV5x4N/7tCsluFMuaUrnpdKiMN8xbRj6bYfZswFKDoK7lEnJESPriYPakweg0vE91lxZB6S2F6FdEOrqk1c3NiEojF6Ty3AjfWmJjlBbk= 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 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