Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp183629rwr; Thu, 4 May 2023 01:02:48 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ55qxQ1nAHJheTxifY+aW3eeTs1qYzWMUwdpLo0faH7s+j2QBzUUaLElbcm0XPpncOXu/rF X-Received: by 2002:a17:902:ec89:b0:1ab:515:27c3 with SMTP id x9-20020a170902ec8900b001ab051527c3mr3339050plg.47.1683187368496; Thu, 04 May 2023 01:02:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683187368; cv=none; d=google.com; s=arc-20160816; b=CIotwb0o7IlJ/uBS4IxbYncwdj0E1swlbbf3xoPbqRv6+4OmpVAOOI6Fhx/vnnwBRD W/tTyjkRFqiwwr00EGqoSBU7a+VCp6ueab9OQXgaPsLq0b2Q/lERYHjKnN+/7L86Z1tH vqp5j0Zk0pGZBjuQNMhxo21CS69wQV0WTKY6xmpx6M7R4YSRjNO6R0ti5CcRaQ+cy8Jv c7I3iowMZFK2S/LSYZZysS2XPICIGklRUu8bbTv124ooLAfiSxls8AxOU6sl53bZX0hA /lA8QOPPyouS4ZMQX6ISoZDAjpXmHBwrL6gu37s/dZgqpshKme0svL6BSSMkDX5pI6/E 6gTA== 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=14yIEEd7A8I6Tu7lFvLcP+c0d1kvUNzGycGQrBMqaec=; b=Qj+YY0rHSrW//H9kqrm975slPOKijz1OH0G5VNuRYjRMn9U0vbKmRVvL2YQFw1jErs ZLuS/phFl8o+9UmvtfWCMHMUC1SM0NceTjMsanXuq1MyvdQu7kmOiUs1ZMBjpGKn8Ee+ 2u27FYtUzWMgPharFHIuxwewQXiuKYQM5aqopBes+eV/UoEqUCdFP3vH8cBbeSBulOWM KzcIrhpOnkzZb/Kej7IvtdkJ3Zo28NnPkNiqqJ77GhyCKNLhlGUR0i+CkChwd9/QBauU lMHi4sQy303OrM97xZz/mrPflMzUYmXHxlxC51Sj0LgWCcVfxb+oE+YuknzWQi9A4uHh rpfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tesarici.cz header.s=mail header.b=i7U3c2nW; 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 jb22-20020a170903259600b001a9b2c782ddsi16547752plb.176.2023.05.04.01.02.33; Thu, 04 May 2023 01:02:48 -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=i7U3c2nW; 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 S229872AbjEDIAM (ORCPT + 99 others); Thu, 4 May 2023 04:00:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229564AbjEDIAK (ORCPT ); Thu, 4 May 2023 04:00:10 -0400 Received: from bee.tesarici.cz (bee.tesarici.cz [77.93.223.253]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BCA519B7; Thu, 4 May 2023 01:00:08 -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 C0CB514F3D5; Thu, 4 May 2023 10:00:03 +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=1683187204; bh=14yIEEd7A8I6Tu7lFvLcP+c0d1kvUNzGycGQrBMqaec=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=i7U3c2nW7tDZIQt+x9yz3m1gnOLRMA9C6yJT6Lzxj+dxqDistyX+bd+0n320wEwJP mG2SyfCNE02FKthsBOaBd1l8X2sl7oLvrB/qCQMI9TdxqtZ39wha4fpP0ZE3+zeKkK k0trzdHlCZJa68SOs/TaUtBngoBADHokTtRxc0S9tbNJ2CGCzrCU1Scif9VY4vZMaG 4N0HqGKW74zhhnlGRus1U5tjOoHSH8T2YLQCYURrBpLx1c6/Vj9FoN6/WcaiorzJev vQPIWwTXe3QxIxMc/r7IVrjtPa9xgEwraQ4rTZJf6649purGXb5q61XhugqznFqKR8 fSbA318uN2Nlg== Date: Thu, 4 May 2023 10:00:02 +0200 From: Petr =?UTF-8?B?VGVzYcWZw61r?= To: Suren Baghdasaryan Cc: Tejun Heo , 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 Subject: Re: [PATCH 00/40] Memory allocation profiling Message-ID: <20230504100002.3d410939@meshulam.tesarici.cz> In-Reply-To: References: <20230503180726.GA196054@cmpxchg.org> 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,URIBL_BLOCKED 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 Wed, 3 May 2023 13:14:57 -0700 Suren Baghdasaryan wrote: > 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: =20 > > > > 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= is > > > > something interesting there. So, with low-cost persistent tracking = we > > > > can determine the suspects and then pay some more to investigate th= ose > > > > suspects in more detail. =20 > > > > > > Yeah, I was wondering whether it'd be useful to have that configurabl= e so > > > that it'd be possible for a user to say "I'm okay with the cost, plea= se > > > track more context per allocation". Given that tracking the immediate= caller > > > 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 b= locker > > > in any way. It just bothers me a bit that the code is structured so t= hat > > > source line is the main abstraction. =20 > > > > Another related question. So, the reason for macro'ing stuff is needed = is > > because you want to print the line directly from kernel, right? =20 >=20 > 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. Another consequence is that each source code location gets its own tag. The compiler can no longer apply common subexpression elimination (because the tag is different). I have some doubts that there are any places where CSE could be applied to allocation calls, but in general, this is one more difference to using _RET_IP_. Petr T > > Is that > > really necessary? Values from __builtin_return_address() can easily be > > printed out as function+offset from kernel which already gives most of = the > > necessary information for triaging and mapping that back to source line= from > > userspace isn't difficult. Wouldn't using __builtin_return_address() ma= ke > > the whole thing a lot simpler? =20 >=20 > 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. >=20 > > > > Thanks. > > > > -- > > tejun =20 >=20