Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1708365rwr; Wed, 3 May 2023 21:06:17 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7jDie7nee3B5WNutrL8rIpLRNzOrP3XtNr/oPLuKaM3Rc2yW5erKP5fJK0lYTyJT2tt8/O X-Received: by 2002:a05:6a00:1a42:b0:643:8496:e42b with SMTP id h2-20020a056a001a4200b006438496e42bmr843922pfv.12.1683173176686; Wed, 03 May 2023 21:06:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683173176; cv=none; d=google.com; s=arc-20160816; b=i1SVGnuVZXTZpY97xaL8tmFPebfFS/WcBJ5xfi+/2yLdJzqV4OhzZU+7mlPZt7TjGj uKkpk6y7uZWj9tZXM2cZuf7IfNZi/sTREb1AqJ/MXKtHlhLSK7TH4koY64b9AwRHRVK/ CS62f5UHAWqc6r9fgre5ZYhMncACyXSp85t8CT1iFyw+SSIYvEzwrAjcDTOnhFq9xr6e 2UvqN0ryrtl5pW2mhmN55nX6MRBua6xUADruDNJANKxYolVJ20rf8wRs35HQ8k08J5qm 93JWLeXk4JzHaudC4hP8Ts84HVG/OudBaEVmZoWS9/20IDE5aVCKe3h01EDHWgIXz9sH xcvQ== 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=ezowVIfZ+j5q5fnHBXFJgjQgqAlO13MfPXw7qEM899U=; b=aOlpkP/dEV6pD1sJrLiNf00Kf0dxiEBQOEoS/CEHrXhCuiU4R/e8kDLb8/GNDzggLD DlR6dNlhQ2qCEnM0t4Ynb7Fjh6j3DLGnR+eKpFsvL+6OuMRmeK4VEoD+5owXp7j3YU8A OHeqtjdnaa2p38FmIUeDYxkIqUrGTFDpHDxry+1n+MHNlH4hKPQp7MyKLBcXyHOG5yvm y93OZOwDZ3nXB+S7QEohDDl+amVUjPMmcKAZ92PB4BSLFM9T7E70h64KVAcjUrsDJGCZ gYpgBQwayejj5NtCONdbDj3xvvHGsy97aMqz86FGBQPwpJyznhDEWmF78TrVr/kX2EeE AEXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=lL+P1HWG; 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 y1-20020aa79e01000000b006432e1ea8e4si2723921pfq.14.2023.05.03.21.05.58; Wed, 03 May 2023 21:06:16 -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=lL+P1HWG; 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 S229784AbjEDDdq (ORCPT + 99 others); Wed, 3 May 2023 23:33:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229742AbjEDDdn (ORCPT ); Wed, 3 May 2023 23:33:43 -0400 Received: from mail-yb1-xb29.google.com (mail-yb1-xb29.google.com [IPv6:2607:f8b0:4864:20::b29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2AC51BFA for ; Wed, 3 May 2023 20:33:41 -0700 (PDT) Received: by mail-yb1-xb29.google.com with SMTP id 3f1490d57ef6-b996127ec71so49655276.0 for ; Wed, 03 May 2023 20:33:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1683171221; x=1685763221; 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=ezowVIfZ+j5q5fnHBXFJgjQgqAlO13MfPXw7qEM899U=; b=lL+P1HWGx+y87/s7tJ3yJEOlJ9xZakfyxCZ/vj2vLDVlNBtKFp5TryG8cJdaJpBcY3 guIC/GIEBTyQZrHE6ZNHiQ86VI1OapFezm0uE0T+1OK+K4KYYfBBjtbLybxs4JzubUJ/ YHIYmrIrkP5sV/C/lw2aAB2KyoF9ze882p2X7gtWbJ7Ck0EEAHwV0AOp5iYiKP9dpnkl JG4AkClQv8a9C8JNwybz3M08XO+E4JFF6RNOKRacmV8gTFgw1n0DajrnRmLfrbF5RGNA oAFHvA1e8eD3Al3/gqVbjERe8sD7tl0wTSvmn2cJLhru0NU5xErhL5P5WdguSe6A94ip wwkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683171221; x=1685763221; 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=ezowVIfZ+j5q5fnHBXFJgjQgqAlO13MfPXw7qEM899U=; b=iPvmxkWDfsK6zIH3/bq3aArwxbfCuc8mlAWQOa5GQTS5Bm4t5M38g7dUfozljbnrH3 Y8xFxOxLfKAUJZNZS5fBTwqLZrwD4UuHT6wA0tHtGD8U0f01qsVsDm+PZkCKORTD2JQ9 ZOTMut2f+8MiKFozizafxkAs5k4Mh9dnojVR+CoBHhICOrADtzZzi1SgAxRbIkZWGaho cTnoLhlDiWIuRAMfbVARqoD8e4ANiz13cam/nOEWTqYdDd/Hhp88VRDKxYTeKPsyvTlE iUUkFXKY1c+mAzS5xnJv1luFKod0QD/Cz0sAsTQ5vE6xVi8/wFqhdybp8UE8GWoQYtw+ 9IpA== X-Gm-Message-State: AC+VfDwz9Oaxg1Fdk061ZeKIZ+b05KcHV8c4wq5VwC+O9PPlTjfrF6Oz DpzFUiHZwodHF4O+k/C6rJwZ67zE+ugZ/NXojH/wZw== X-Received: by 2002:a25:b55:0:b0:ba1:8b5a:581e with SMTP id 82-20020a250b55000000b00ba18b5a581emr1541686ybl.17.1683171220475; Wed, 03 May 2023 20:33:40 -0700 (PDT) MIME-Version: 1.0 References: <20230503180726.GA196054@cmpxchg.org> In-Reply-To: From: Suren Baghdasaryan Date: Wed, 3 May 2023 20:33:28 -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=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, May 3, 2023 at 7:25=E2=80=AFPM Tejun Heo wrote: > > Hello, > > On Wed, May 03, 2023 at 01:14:57PM -0700, Suren Baghdasaryan wrote: > > On Wed, May 3, 2023 at 1:00=E2=80=AFPM Tejun Heo wrote: > > > Another related question. So, the reason for macro'ing stuff is neede= d 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 b= e > > > printed out as function+offset from kernel which already gives most o= f the > > > necessary information for triaging and mapping that back to source li= ne from > > > 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. > > I see. I'm a bit skeptical about the performance angle given that the hot > path can be probably made really cheap even with lookups. In most cases, > it's just gonna be an extra pointer deref and a few more arithmetics. Tha= t > can show up in microbenchmarks but it's not gonna be much. The benefit of > going that route would be the tracking thing being mostly self contained. I'm in the process of rerunning the tests to compare the overhead on the latest kernel but I don't expect that to be cheap compared to kmalloc(). > > That said, it's nice to not have to worry about allocating tracking slots > and managing hash table, so no strong opinion. > > Thanks. > > -- > tejun > > -- > To unsubscribe from this group and stop receiving emails from it, send an= email to kernel-team+unsubscribe@android.com. >