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 2BC24C77B7F for ; Mon, 8 May 2023 16:10:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9B6BE6B0071; Mon, 8 May 2023 12:10:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 967146B0074; Mon, 8 May 2023 12:10:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 806F76B0075; Mon, 8 May 2023 12:10:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 70D536B0071 for ; Mon, 8 May 2023 12:10:15 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 3D2CA140766 for ; Mon, 8 May 2023 16:10:15 +0000 (UTC) X-FDA: 80767574790.09.C365E49 Received: from bee.tesarici.cz (bee.tesarici.cz [77.93.223.253]) by imf14.hostedemail.com (Postfix) with ESMTP id A964B1000BD for ; Mon, 8 May 2023 16:09:19 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=tesarici.cz header.s=mail header.b=CADkuX60; spf=pass (imf14.hostedemail.com: domain of petr@tesarici.cz designates 77.93.223.253 as permitted sender) smtp.mailfrom=petr@tesarici.cz; dmarc=pass (policy=none) header.from=tesarici.cz ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1683562160; 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=3vhaqezEwBKNVkdCmLqVMfvToTleKNzHmBxoVSbRVoQ=; b=yU9FZJEk2rpMzj1tYSvlW+WeHVq1+OYaWFkcui6ZOSS88GrW9nUgcCKl2U1KbGq+UTzhZR YblInWRhh/c6ObXlY1ogIhs2KJHfy9iyVGElUNmAggeHGYURnDxdijWbSI5pIbhLm8210B OS2ofoKU0lGopI+qtOrGd/Mw2Kn5Oec= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1683562160; a=rsa-sha256; cv=none; b=n7p5R9S/zMbHnRYZ7QTkdaEp9uNNhGtOA9+6NM9UGUF/e73db7ru7l0/GCBp8ZNOSl+0WS JHwEpwuklCEMfAuPICttx3+B6ILmmGrFWnlge1cPTcvhlgly4M//pTcCUIaFjAST0ybdfe +MdUbcN/WNBQtpTuqd+5IqJHD5ur2OA= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=tesarici.cz header.s=mail header.b=CADkuX60; spf=pass (imf14.hostedemail.com: domain of petr@tesarici.cz designates 77.93.223.253 as permitted sender) smtp.mailfrom=petr@tesarici.cz; dmarc=pass (policy=none) header.from=tesarici.cz Received: from meshulam.tesarici.cz (dynamic-2a00-1028-83b8-1e7a-4427-cc85-6706-c595.ipv6.o2.cz [IPv6:2a00:1028:83b8:1e7a:4427:cc85:6706:c595]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bee.tesarici.cz (Postfix) with ESMTPSA id 481AC155357; Mon, 8 May 2023 18:09:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tesarici.cz; s=mail; t=1683562155; bh=tZgheluO1aPVjg06yZiAFzLNKgO2HIpkAjGUkuoz+Xw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=CADkuX60QMsFSs5K3h85ChAjshZd0+5QyWqLXjAQ5u35m53i5zXISvnd+ljlG5rW8 3yfjn5cTtoMKzWJyMVk6cVz/NtUgY7fgdoS4Lh0LIxQNcHDhj0HSpdaF4B+jJ4EmMA 5185N1LV9wkMWh/nAmI5f8IS5nYaeIOztE4g7FmmZN38FcuYByM/VlMF2byMx02IzO x7xCDbrZqC7ZiTvCVcnU/9QA9D8zIWHDYJDuqOaxAmw4//Gah5Zqccep8UubMR3MsW 5sv9E3yE4y9cJgzxnJzn/sRvFqIs1IbT/NiGx03o8Sb1jC690ErN5b5lmVyIFNfb02 FQ4gjDERvn0bg== Date: Mon, 8 May 2023 18:09:13 +0200 From: Petr =?UTF-8?B?VGVzYcWZw61r?= To: Kent Overstreet Cc: Michal Hocko , Suren Baghdasaryan , akpm@linux-foundation.org, 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, ldufour@linux.ibm.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, pasha.tatashin@soleen.com, yosryahmed@google.com, yuzhao@google.com, dhowells@redhat.com, hughd@google.com, andreyknvl@gmail.com, keescook@chromium.org, ndesaulniers@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 00/40] Memory allocation profiling Message-ID: <20230508180913.6a018b21@meshulam.tesarici.cz> In-Reply-To: References: <20230501165450.15352-1-surenb@google.com> <20230508175206.7dc3f87c@meshulam.tesarici.cz> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.37; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Stat-Signature: o76b6b86xa53hit5eupokg3g8r8cffxs X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: A964B1000BD X-Rspam-User: X-HE-Tag: 1683562159-782090 X-HE-Meta: U2FsdGVkX1+u1kYqvtIxLNmGN3IoBqws6TSkg32W0eDc0oilIcc9amgQaxW1kh9NpD+n4iAyY7+0AjiC0oqLrhA7P+E0uXVX6I+zDJhroXuOcFfv3vepzoWJ6pUKHASe6eVPhUbEag2A0ZrFhtP99iVzVmz+5p8nxNmyLB+NQ2nhQBzmGooxaCciAbS0iHX2kBtudziYv71jNbLf3ekKZHEk94rMTgFNhvRkxXQhklXBDileOPII5h6cmc4/OA0Bk9FOUEYGDp2FepKQ4kl7NPeVyHGGYOEvOnIpRGkRW4CPy/Ig+SPbMiqy12JcGyZgLAaR8GvJ/v9cYRYx3hHSEZadP1+zSZCCFBEHU5i3Oi6zoKk/tBjzmYDeLwGAXZbVtHNSKYVUzIEADOYpbw4jTZfeqvFpnbqXhIhCi0ABH+eQdh0zsxq1LL/0sBXtxpwT/LL3O4AnQb8oQhyWQIfm2RWSGhfC0fE7Sthf9etFxUx7e6Uzljgl7f9MpTk+l6HjV3d2oeYkW5+IdQY2MquqRu1EqT8+QK8cVZnd95mTXg2lryD6nBWe3gpm3fniLP22QIh887nsWTwyDOn5pHJppnuPzfLLyl12/FbG3XUSoSoSnWc5ttm0+YaQ/Dr2HLw42uSWOrMww0HjRoeSgo/2goKXcB6P2E5A+dUaZzvge9YiIRqLrerokbGfUAYH4gQ91CxWSAev7V/r/mcFTlYntAdC2BqnWyli10meHS8635N+mbJhE3A7hsD5CmXIClk7Ydp8/e4ohWyH9dLkq+lxyLMt8RJLl4TACCaImJO41zo47wrM5YYT6nlPyajr/ntQm8CkBATISG2SfvW7g9Gbihk1lTfuG8xOeiu5Yh1fMVE183JVA1nuTV8TIY0A5HcE+OgLZcedFGo+jNc2NTrMLRJSKOIwN0hKoHAulpFF6w63uFVDyK9pJYcj8usZHrD+aAnbe2TvWqyXV3U9lgo eP0jZCvS 9mqK5A2Oj1Rr6qdOnusSfVyPTgRR9kzMf4MkkbOKrEOY68ajstIZELeX/0BjvgBKlQTfUegxUgdMmQ8tmEPPHs5D1vFhKjE5BA3HcEVapUIymFzKeP80nkBWFq6T3F8JBgAUD1Q+RjaoqXPz686Yjhdaf5O/lpl0Icr/TEljg0m4GRLya2Zp+TlBii0Bh5NyN6P56ptqqMuR2NOCCbZ3WcAmh93CFiGPhvDwu13uGcervluExQkTAMN4Z++UuGqIpk48N8S5X1DA2YMICmeJDy8Jmc2/Ca39vC2OE4pZEdzoErKzxVOm9ttXU52YduNCLLwL5J83oSSdAQ5U= 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: On Mon, 8 May 2023 11:57:10 -0400 Kent Overstreet wrote: > On Mon, May 08, 2023 at 05:52:06PM +0200, Petr Tesa=C5=99=C3=ADk wrote: > > On Sun, 7 May 2023 13:20:55 -0400 > > Kent Overstreet wrote: > > =20 > > > On Thu, May 04, 2023 at 11:07:22AM +0200, Michal Hocko wrote: =20 > > > > No. I am mostly concerned about the _maintenance_ overhead. For the > > > > bare tracking (without profiling and thus stack traces) only those > > > > allocations that are directly inlined into the consumer are really > > > > of any use. That increases the code impact of the tracing because a= ny > > > > relevant allocation location has to go through the micro surgery.=20 > > > >=20 > > > > e.g. is it really interesting to know that there is a likely memory > > > > leak in seq_file proper doing and allocation? No as it is the speci= fic > > > > implementation using seq_file that is leaking most likely. There are > > > > other examples like that See? =20 > > >=20 > > > So this is a rather strange usage of "maintenance overhead" :) > > >=20 > > > But it's something we thought of. If we had to plumb around a _RET_IP_ > > > parameter, or a codetag pointer, it would be a hassle annotating the > > > correct callsite. > > >=20 > > > Instead, alloc_hooks() wraps a memory allocation function and stashes= a > > > pointer to a codetag in task_struct for use by the core slub/buddy > > > allocator code. > > >=20 > > > That means that in your example, to move tracking to a given seq_file > > > function, we just: > > > - hook the seq_file function with alloc_hooks =20 > >=20 > > Thank you. That's exactly what I was trying to point out. So you hook > > seq_buf_alloc(), just to find out it's called from traverse(), which > > is not very helpful either. So, you hook traverse(), which sounds quite > > generic. Yes, you're lucky, because it is a static function, and the > > identifier is not actually used anywhere else (right now), but each > > time you want to hook something, you must make sure it does not > > conflict with any other identifier in the kernel... =20 >=20 > Cscope makes quick and easy work of this kind of stuff. Sure, although AFAIK the index does not cover all possible config options (so non-x86 arch code is often forgotten). However, that's the less important part. What do you do if you need to hook something that does conflict with an existing identifier? Petr T