Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1330061rwr; Wed, 3 May 2023 13:34:45 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6jja79h2R8JjLGixMoAF6iVGGClc/ArslMDgcPprpRLRkxGHs+alhRmgzvf6cfoeweGyL/ X-Received: by 2002:a17:902:c403:b0:1a6:a8e5:9240 with SMTP id k3-20020a170902c40300b001a6a8e59240mr1715546plk.4.1683146085527; Wed, 03 May 2023 13:34:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683146085; cv=none; d=google.com; s=arc-20160816; b=bebsITRrxLpf+DnKzKPHfyxPuW8N0KYUqzk6zPy+RzjSjB0npfRsGnNv7lEeRW8y7S 8DJYz9kNLgn46JbfUywfmtZTZ0El35mFMPhiuhIuSwGPWFLXsXV7fnf5zHaarhYWKqY+ nspXZP0OP3e2SNE3q0twk6vPXeyeHCgsic8Uc9gTLG6CPY9+yLJI/E2xDu7HWsY9VUBx MSpD3dEKa9h/GXsAeh4gla5HOMlcjsprwU/qRwVkcO5oBorl4BNZ7kxESpqxVE2E6eCw 36QHrOUYQH5JLNSxtI/ou+GLwGKIL2v1+mzRGL9E/8UXjKUhyFUCF08hA1ugei2zXkZQ 8zug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=fJv5xHBTJjNv/pix2rgh9sMW7sCnrk66nOy29HPAlus=; b=ui8Kka9nHmUmjsSB7lhAxoDofzHgw+7esF78307O/lTU1Zhq4kYLbiZKrRZQM9GZGa 1bA8I99vjzjFToE8a4VvojG9jRH9ToK2hts/xS25GxrIejhJnFtIt6v9sUDBtSjL4rlt EkXGCrRw5wK0QiT5ccAgtzyQp/bZFVqy59OAvt8aPEpi6UaIeYVt3nadZBfzvlULWvLA reDLZ9f1a1gLHMUiUrPT7zJBZJTqh9OZxQsmJDErlmvklZ9dba43hEEHFP54INzLqKsc c1uou2P0QHq8y4WABBscy2Gn1CGwnsbtAFPuBhnCMZvUWjwxenozCgxS4yT9bfJkgC1O kwKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=UCO8xAxP; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f11-20020a170902684b00b001a229e52c19si33205494pln.91.2023.05.03.13.33.42; Wed, 03 May 2023 13:34:45 -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=@google.com header.s=20221208 header.b=UCO8xAxP; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230051AbjECUPz (ORCPT + 99 others); Wed, 3 May 2023 16:15:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229982AbjECUPx (ORCPT ); Wed, 3 May 2023 16:15:53 -0400 Received: from mail-yb1-xb32.google.com (mail-yb1-xb32.google.com [IPv6:2607:f8b0:4864:20::b32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA4568A49 for ; Wed, 3 May 2023 13:15:23 -0700 (PDT) Received: by mail-yb1-xb32.google.com with SMTP id 3f1490d57ef6-b9a879cd49cso8100637276.0 for ; Wed, 03 May 2023 13:15:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1683144920; x=1685736920; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=fJv5xHBTJjNv/pix2rgh9sMW7sCnrk66nOy29HPAlus=; b=UCO8xAxPQELEnJ5Z/+6POOiyN0vC8Y3LS4oWyDMuhEhZvFzcfiun+ebWGPwrO+pD6P oaWSGqmefHbl5lAEiPf5lmUVnYEfPjsrvltc8OpHClJDRLqR0c6JCt2K4/o8XHiKCVdf J53ZnSfM4WQ/BqrKp+eVl6M1p/n6Qe+G3n50PB19Uzdxt6cKRczUS8ApWupvLyGowGSr nGY8DkG6nB+Z74vkrN7ka4kE+r+AVY9ut3CcNzBfOZ5eIHL+qS/vkhlLgZTTLFk7Q8GU 5cYkPlXWlkK/9gZow1krRfzsVVYIijdz+900Nl7CuaPdx5c8WOD0aSivErWELXWkx49V I4sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683144920; x=1685736920; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fJv5xHBTJjNv/pix2rgh9sMW7sCnrk66nOy29HPAlus=; b=Jw0qAEDHWS4oyeH9vLB2XQG/hHDDHMeW476soOH5skza+KMAH4zD48j9gVyP2zzue3 SWwSEKRG0b+rzC6K5+K4UpWfs9gsHvXwDQ4zRhtB+ZHZqhAERPtqWdfIX/v52GQpmsR4 5oCUTOKAyDJSDaxZEaUjHAtcpR4BlQSnCIk7gnTIxKpwHsp2nG+lgVzjVxzoUimlX54u gWKZ+8BCUtO0Wfl2sT0m5CAnDygfg5OFYko+oQfi5En1HwOl9Ytqqffnq/ObIWZ30JDl fMw5E6PE1LMhCzYET73VlAqbb97Qjnx3yTW02pM2cGtK4XDjKMGq2C9JbV0xzV3N2saW ldvA== X-Gm-Message-State: AC+VfDxIDthyFoyAeBx9dhUHolHXtMGqrXICICgqVVNtXFJNFk7uXwGL Ka3jWOsK6fH+7xf/kCzXEHjDZNYlA4I8McKrUOoHHw== X-Received: by 2002:a25:2b45:0:b0:b8e:db20:eccf with SMTP id r66-20020a252b45000000b00b8edb20eccfmr22508398ybr.55.1683144919429; Wed, 03 May 2023 13:15:19 -0700 (PDT) MIME-Version: 1.0 References: <20230503180726.GA196054@cmpxchg.org> In-Reply-To: From: Suren Baghdasaryan Date: Wed, 3 May 2023 13:14:57 -0700 Message-ID: Subject: Re: [PATCH 00/40] Memory allocation profiling To: Tejun Heo Cc: Kent Overstreet , Johannes Weiner , Michal Hocko , akpm@linux-foundation.org, vbabka@suse.cz, 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, Alexei Starovoitov , Andrii Nakryiko Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 3, 2023 at 1:00=E2=80=AFPM Tejun Heo wrote: > > Hello, > > On Wed, May 03, 2023 at 09:48:55AM -1000, Tejun Heo wrote: > > > If so, that's the idea behind the context capture feature so that we > > > can enable it on specific allocations only after we determine there i= s > > > something interesting there. So, with low-cost persistent tracking we > > > can determine the suspects and then pay some more to investigate thos= e > > > suspects in more detail. > > > > Yeah, I was wondering whether it'd be useful to have that configurable = so > > that it'd be possible for a user to say "I'm okay with the cost, please > > track more context per allocation". Given that tracking the immediate c= aller > > is already a huge improvement and narrowing it down from there using > > existing tools shouldn't be that difficult, I don't think this is a blo= cker > > in any way. It just bothers me a bit that the code is structured so tha= t > > source line is the main abstraction. > > Another related question. So, the reason for macro'ing stuff is needed is > because you want to print the line directly from kernel, right? The main reason is because we want to inject a code tag at the location of the call. If we have a code tag injected at every allocation call, then finding the allocation counter (code tag) to operate takes no time. > Is that > really necessary? Values from __builtin_return_address() can easily be > printed out as function+offset from kernel which already gives most of th= e > necessary information for triaging and mapping that back to source line f= rom > userspace isn't difficult. Wouldn't using __builtin_return_address() make > the whole thing a lot simpler? If we do that we have to associate that address with the allocation counter at runtime on the first allocation and look it up on all following allocations. That introduces the overhead which we are trying to avoid by using macros. > > Thanks. > > -- > tejun