Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1160109rwr; Wed, 3 May 2023 10:56:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7sx6lcxYBZJuxVP4WyV/GzmQoQA5Z2nndc0Njn2qOfYTOTkrrc6t32F0TWJrwDftDcblHa X-Received: by 2002:a17:90a:b016:b0:24e:2e9b:6164 with SMTP id x22-20020a17090ab01600b0024e2e9b6164mr6040099pjq.33.1683136580914; Wed, 03 May 2023 10:56:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683136580; cv=none; d=google.com; s=arc-20160816; b=byWRwFUgORwmbJxVjI2g/jfpBQ/F7EPPz2q3/ENhesGsCv/K8gV/hUqBnFgssImFv/ eH6xHJ7F59f3oErkjQKo+24TnOuJyYvvreA7DvtoquDoE2HtRbtAkWSdkINLC68Sw6h+ vv8Yo2djZCqAbqjFlpVTJzFdEaykxs08guRvNmkp6Tw0TpME5YmudXraq8F+cOqymj5f 4HDPUik3hAcclCdIccIeEwk0FJ8Eq0aeDWH9VgdPpncICU4w7eCPG95vU4BS+js84H2q ihz/t8psmLBkglZJFAGz7Ae2utX0eTTdPB3oO6zcfgIceIIr+4ogo8yzEo3JsBvL6yvP FpKg== 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-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature:date; bh=VLjEZmUZdVYCB3vahsC4N4RlfMUKbdvDvHs1QSrBbkc=; b=fIOu8hYMgeezTGSNfqVyOYpzRcv7QE5VV8l2TpbKagx+5Mv/qxwxW7RjKdPgbPLaxZ 1S+FLhxtlSVNL5EZsBc3v3ny4/QwAxy/8ykJHRDde6tuHvh6OpTOs5NcOwIfuD9Tgvpw empmDMSbhZCH8m/Hm29G0LC+fzOuAY6euhxyFq6QL+RjPC0iqVUtRoxX0PROdd+r8nqa ldG3W15cKhk9c5Wr7z+skXkaT4Q2VFbFXfZBCiH4WaiClVuFtrfoZPUd/esOTkqVwrXS cxdIO5kq3l8DmvJ8WRsf/QEnR6Gno9naqQPNnkxHK1MSZXe2xPxuqqnlmVYT6Z4h2rL8 WU9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=Bqk+D3wk; 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 t16-20020a170902b21000b001aaf607910fsi7826841plr.376.2023.05.03.10.56.06; Wed, 03 May 2023 10:56:20 -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=Bqk+D3wk; 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 S229980AbjECRpT (ORCPT + 99 others); Wed, 3 May 2023 13:45:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229498AbjECRpQ (ORCPT ); Wed, 3 May 2023 13:45:16 -0400 Received: from out-62.mta0.migadu.com (out-62.mta0.migadu.com [IPv6:2001:41d0:1004:224b::3e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CD0876B4 for ; Wed, 3 May 2023 10:45:11 -0700 (PDT) Date: Wed, 3 May 2023 13:44:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1683135908; 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: in-reply-to:in-reply-to:references:references; bh=VLjEZmUZdVYCB3vahsC4N4RlfMUKbdvDvHs1QSrBbkc=; b=Bqk+D3wkDUmlYZ1as8gRsPGcBGwt1SpSgZ4HIXBomyou3scD9fsxFx8d9Pi9i0plH0MlvB Wz5W7oioStPfXkk2kiF/4sAZhv4YdHhahVNxY2sEvKz1jU0Q3fpXkK6JN4TWTcevaEcWHI xj1ZN9ZDwCFrzS5sVFM3Iqdhgz6ddic= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: Tejun Heo 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, 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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,URIBL_BLOCKED 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 Wed, May 03, 2023 at 06:35:49AM -1000, Tejun Heo wrote: > Hello, Kent. > > On Wed, May 03, 2023 at 04:05:08AM -0400, Kent Overstreet wrote: > > No, we're still waiting on the tracing people to _demonstrate_, not > > claim, that this is at all possible in a comparable way with tracing. > > So, we (meta) happen to do stuff like this all the time in the fleet to hunt > down tricky persistent problems like memory leaks, ref leaks, what-have-you. > In recent kernels, with kprobe and BPF, our ability to debug these sorts of > problems has improved a great deal. Below, I'm attaching a bcc script I used > to hunt down, IIRC, a double vfree. It's not exactly for a leak but leaks > can follow the same pattern. > > There are of course some pros and cons to this approach: > > Pros: > > * The framework doesn't really have any runtime overhead, so we can have it > deployed in the entire fleet and debug wherever problem is. > > * It's fully flexible and programmable which enables non-trivial filtering > and summarizing to be done inside kernel w/ BPF as necessary, which is > pretty handy for tracking high frequency events. > > * BPF is pretty performant. Dedicated built-in kernel code can do better of > course but BPF's jit compiled code & its data structures are fast enough. > I don't remember any time this was a problem. You're still going to have the inherent overhead a separate index of outstanding memory allocations, so that frees can be decremented to the correct callsite. The BPF approach is going to be _way_ higher overhead if you try to use it as a general profiler, like this is.