Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp4555218rwr; Mon, 8 May 2023 09:14:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4mMJXAlmCF0UfgGsgCZmThrlKUyVjHeRWSYAF5SrbCrIanGwHDnSEwovmD6j1OfKm7/cUp X-Received: by 2002:a05:6a20:918e:b0:f2:45fd:1de2 with SMTP id v14-20020a056a20918e00b000f245fd1de2mr14369705pzd.19.1683562451756; Mon, 08 May 2023 09:14:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683562451; cv=none; d=google.com; s=arc-20160816; b=bf4tzs+ka4ViNEQoqzdHPdy0LevlFAar28sHwCqx4Zzw+eshEJ8i4lhVkRzOuAYRFV L9wAyYznQlo9Z2ERrCxPrWrVIw9XwBAvPTky7OJV2NLKdvQQnb7gkzVysNMtQNU3CoQ4 hBxki6WTMpw+/oaDKPRECwWbCdrgptXbq+BjrZLzNAFCbWumU9hEKwgMrueHN0ClysIQ HOlWP6jAMZVSfL2HOmznKf1yHR3VcbCNJM99xHaGc06jyWuErzgt1dUg8dxyteh3fhcv Dxbjy6aeZOC2x8TytMYAC3bsGPFMkgGmeiZ86RL9DdI770gWBwWKirzgVnEYyKMPVF01 CUVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=3vhaqezEwBKNVkdCmLqVMfvToTleKNzHmBxoVSbRVoQ=; b=l3XE25bKHqlw/dQs+Wb67X/LshLUQDe43u0t1UBUIFgq4RJaFcfSjhtPM4n2vAlQ+3 HyOdVGKfn82vLGPQBbVeoSf6CQvgII0PLlvfPiueUwt2Dy+njjzTMCTI/hsTBW71QWU9 h9DCl91EB2WM2RDhBWmYviSLHz48j5J2GHXv3TWV0qwdSxZcB/QgPJT4NBNVSpiVxBmy 0U7rSGYuwO8CQJ0XFNE00Bn5Ehiq1KD//GqmKWyBjbdTZcFWSG22F7c5CAUqnG+8ZHmG IenS3+xDwPZICdo8dim2Njdcyv9xBVqnG9bUax1VyDjGZGBx141ggVrQ978VzE3MiX3F tSxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tesarici.cz header.s=mail header.b=CADkuX60; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tesarici.cz Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b5-20020a63eb45000000b0052cbf3e8b72si5948674pgk.644.2023.05.08.09.13.51; Mon, 08 May 2023 09:14:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@tesarici.cz header.s=mail header.b=CADkuX60; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tesarici.cz Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233793AbjEHQJr (ORCPT + 99 others); Mon, 8 May 2023 12:09:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233585AbjEHQJi (ORCPT ); Mon, 8 May 2023 12:09:38 -0400 Received: from bee.tesarici.cz (bee.tesarici.cz [IPv6:2a03:3b40:fe:2d4::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B21D65AF; Mon, 8 May 2023 09:09:21 -0700 (PDT) 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) Authentication-Results: mail.tesarici.cz; dmarc=fail (p=none dis=none) header.from=tesarici.cz 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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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