Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp4573738rwr; Mon, 8 May 2023 09:29:29 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7g+JdAw7EekoYm9SXxmWU3f9SphjpikhzbwGoDuaVOT/pSfd7ZtJ1xtSiSBpR3X7Bl2Jm9 X-Received: by 2002:a05:6a00:148a:b0:63d:3ddb:5f3f with SMTP id v10-20020a056a00148a00b0063d3ddb5f3fmr15290114pfu.0.1683563369165; Mon, 08 May 2023 09:29:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683563369; cv=none; d=google.com; s=arc-20160816; b=sHEZSLfPPviqT6XzZvtfx/OcL1xF9l8PPLGXq0snyqUShE9g3Gciz4lctwVLyieXKF k6smb5PUnFJMWNEHuSvBtt6ifEdZ4QY87gsvzpAqwxRf8JvhW2q43oiLjgEwjD0s5LvB HWh1/LA2S8Q15ZSUom/XO1ZgxatIpAiUQTZJcbpvgurZA8QZGd7D85ZNk22DRDkkw1RH gdygsc41xzJUmLfERnzpBkurkWH9IgW3f+w47VtgVhUdb6JuqSvbwdcqv8LAF3XSJUM+ xducwRcnSgHMh+syHNA5+MS92aDqearHd/p8ck1XpmjB4iGnhxsBvQX7OXJ9GrzN2/Yu rRZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:dkim-signature:date; bh=647sHPv4B7hFuK57ZzB2dzj7RoLmpQ+nMy5wXGAldL0=; b=RXmspfMkXk4oGVYYQfXDfioN1SVSXFDrqLy6RVZcn0Y8YQjbLjj4lKrStDo1WhdE7t q0WJ62bydB82N9H+T4gYbvQHzsL3pa9EBW2ItYMKX9qjuHcj83SIUzA4XbRIfl7EQult hkiF/idGQma5KJHBzjf7dAzulgiFf0i1B3AZhOX5owGeUWnV2JUqkZdyxTuwnEr88sAl pRxPg+taZ92sG/2Ucb2bv7wHW1SRlbjqlj/PHi7ipP96wVzlGC5n+evS3XGVyuTVJBJg TWS1iB1jsxIUfXLkWk709OIuMvY+/9FuI7LSBtk5OOZQrOiy7i+/P6ODrWKiCeZ7jNcl QisA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=pAEukJar; 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=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a69-20020a621a48000000b0063d2eae52cdsi240794pfa.224.2023.05.08.09.29.13; Mon, 08 May 2023 09:29:29 -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=@linux.dev header.s=key1 header.b=pAEukJar; 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=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234691AbjEHP5a (ORCPT + 99 others); Mon, 8 May 2023 11:57:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234406AbjEHP52 (ORCPT ); Mon, 8 May 2023 11:57:28 -0400 Received: from out-18.mta1.migadu.com (out-18.mta1.migadu.com [IPv6:2001:41d0:203:375::12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 187E86A64 for ; Mon, 8 May 2023 08:57:26 -0700 (PDT) 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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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, 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.