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 CA1A0C7EE24 for ; Mon, 8 May 2023 15:57:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 527E06B0071; Mon, 8 May 2023 11:57:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4D7386B0074; Mon, 8 May 2023 11:57:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 378B26B0075; Mon, 8 May 2023 11:57:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 253306B0071 for ; Mon, 8 May 2023 11:57:29 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id D63DAAD7C0 for ; Mon, 8 May 2023 15:57:28 +0000 (UTC) X-FDA: 80767542576.07.992A1A2 Received: from out-49.mta1.migadu.com (out-49.mta1.migadu.com [95.215.58.49]) by imf20.hostedemail.com (Postfix) with ESMTP id 98EAD1C0012 for ; Mon, 8 May 2023 15:57:26 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=pAEukJar; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf20.hostedemail.com: domain of kent.overstreet@linux.dev designates 95.215.58.49 as permitted sender) smtp.mailfrom=kent.overstreet@linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1683561446; 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=647sHPv4B7hFuK57ZzB2dzj7RoLmpQ+nMy5wXGAldL0=; b=49e9l7/aotCgjgyLtInTokdIe0b4JZytIbSRdgQ9z/BMzJWFNtmN8p68j+E47ZunDEMPSZ +J4bK6CRGrvs38Q5JWBZoLUsfv0ga9bNG4OIl1LYA7jB/Qgd7E1ZdhMQemSg5C26jxViUG Ct5q/KN/PvcLu5Oy3+MB2+oiX+y2/nc= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=pAEukJar; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf20.hostedemail.com: domain of kent.overstreet@linux.dev designates 95.215.58.49 as permitted sender) smtp.mailfrom=kent.overstreet@linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1683561446; a=rsa-sha256; cv=none; b=SAOlSkwCDuCHJUyz+XTBS1zHj7ijsOPUEF9JIk9n3CBz4gMFdfnKiiZzaXiGN6GZSTAmG3 nIbcaKfxFQFb93gXpnoPSCGTTD9RiArq8+DXXhrkQT6ezA508viX0t0zWENayStKE64hme C97avQT9cQKxk++lCL7Xj1cVplXpz+c= Date: Mon, 8 May 2023 11:57:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1683561443; 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=647sHPv4B7hFuK57ZzB2dzj7RoLmpQ+nMy5wXGAldL0=; b=pAEukJarAZ9zfpJQyxkLYirHPfIniZoUfqNC9brusyZBZ09sv28sxhM4k4em4nlQvaS5Do IxU3+yZoRUn8u1GNjUqpuj/xVZafV+nob5RQGwT3otweRNMnXRavTo5ic8BMQRHWe2z5mG jLofy7PdFoubJwBsB9N6rzDM0Y35kcU= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: Petr =?utf-8?B?VGVzYcWZw61r?= 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: References: <20230501165450.15352-1-surenb@google.com> <20230508175206.7dc3f87c@meshulam.tesarici.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230508175206.7dc3f87c@meshulam.tesarici.cz> X-Migadu-Flow: FLOW_OUT X-Stat-Signature: wgp8n9ikwfzzwiqtxmo93moymsemgsri X-Rspam-User: X-Rspamd-Queue-Id: 98EAD1C0012 X-Rspamd-Server: rspam07 X-HE-Tag: 1683561446-927344 X-HE-Meta: U2FsdGVkX19WQ2cY8OM+MFZxS4iZsWn02xV9sTRGWbcua7HY7uIpqKo0b1D7TZkuqJmUChXJB9IuY0o9uOpEbRmjC5EsTQ6tw0A6pENTCL6qF/bIvYe4qWmYpMeyjn7lCo5Rt0JCJluZfR+ka7fmLvLeL2BLgT1OK53yMBgRcY3HxT4pPM+JHRppxLg6hBLGyYN8qD/4gSoEaar8Cki2J5zgM3SGiJfsPmatSCWecr9dzYPYKMTl/e6yV60INoc4uXZLtR391bLMayJNNdafYLBxtUxSQ+Icg7xYVb03j8DNmW3M92MXkG7PaC72emmZs2o8TNKPwn9rG9XN4Kdtbar9BsVV6ma6ndFduU4kkASGRqvUz6W14lAS1DnC4Z8/EywPjoutyc37OBGdQ/CP+xq3Z9ASl8Y3Fi9RARL4NQVYhbsACfFu5r/Eku//UqSMFt/r891jyJQNnGnHNYxM70WwXh1g+f2w3oyDnylapbNhkj1C4K07GDaXV0Vi9tKSZCb54DlEHA6Xc3Pj2mjTzPaKRxsilBESz16K375XLKZDaHBqmtkqRPqU2R1AuwHxdBL6lgUshW9GIy8rrdjRqZz6pBuwh751QuDw3FpWZ4eOlR85Stfw6bntIaN9ngZc6LibZKjppzx73YcoZcj3/YtG4i0Hl+WlA+igznNhM5+hOgzzXYKWaTpJXVHV9xyu+bR8s6HJGrUR39rRP2MMTBiHuO9ndjgJskZqW+qmJcAxwyZKf0wrrykuuUKDQ3LTL55fDWZ31tIPvXXyl6RUETlClOMDyZxLixsgfbIp81QrTzbaoHh2XdkyqeGwr8R4RXrsHafbgiGG/RTukQOJ8X2yZlddnwpsu9giE4fNFDBsXL+RwraXH7V/l6w4ZaywHsl7ZwoeHMIjzY3a6xX/CWY/3LVCD0kQ9Sn6unhZPyPCQLINH3l87O7Sp5F9upOiwY10ThllemuI7DjQAZI EvHN5Tiu RD7f2PYKRVJVQPjr1htFuVBH6SQsYLOuiUuIksAFGuXiYERaMaVxuGdk8vrw827RPv2M7IzGrcY+xEClKsGQV0FfVNuqAyHexRR0GC5EOKCrNFqOmdbCtts/6ow== 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, May 08, 2023 at 05:52:06PM +0200, Petr Tesařík wrote: > On Sun, 7 May 2023 13:20:55 -0400 > Kent Overstreet wrote: > > > On Thu, May 04, 2023 at 11:07:22AM +0200, Michal Hocko wrote: > > > 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 any > > > relevant allocation location has to go through the micro surgery. > > > > > > 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 specific > > > implementation using seq_file that is leaking most likely. There are > > > other examples like that See? > > > > So this is a rather strange usage of "maintenance overhead" :) > > > > 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. > > > > 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. > > > > 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 > > 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... Cscope makes quick and easy work of this kind of stuff.