Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1193884rwr; Wed, 3 May 2023 11:20:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4tp3aaE0+tCdh7nuAfY6dwsArG/VqpqUPPIe2FuexZdF8HKMVbWTMlO1DLZHFtxCzZjsP9 X-Received: by 2002:a17:90b:17c4:b0:247:78eb:cb96 with SMTP id me4-20020a17090b17c400b0024778ebcb96mr20699082pjb.17.1683138054161; Wed, 03 May 2023 11:20:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683138054; cv=none; d=google.com; s=arc-20160816; b=yXlFh4f8oSDN56r+qzxS/E1e12PYQ+J8TzvZFHQKyFZHigoiaREwGPfowlpi7swjNg fJW/HR2atTnouHLEHZ2SFMmwqwGPo00Nsu6IrK2f363RoeGBzGCwlBdxJdrzQoaKXpv5 2nXK4s2QgrxYsIvm/WktQ5qAy/RnbPLjuNUGfcwvdVVOzGMYTh7N151hLpASNarHqJVu 95isj3FBbRCCO3szCtq1/HnmgMzTRXvzgOmb3qpCufGpPTkY7tqbu0ev6apZ/BQchszV dV2FU7bxFxvwG+YKHZkc9K++4S66+dZVnN39q5gBvDkd2qMucyRA9lRvZZkaH0/USkwq V1Vw== 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=lYpn5fAZ9k+tc7itapEv1evmei0G939nEHfVs4IvTnU=; b=gupbi9dRZ27MrkgrFM+0UM5KpUQ06EEPQboOgiR4AKsmizSSVL9ziNe7oE+orlGXZQ lBfQk/6ERLRvF4gDFHlD3le0hlzAIq6N8MSI63f2WmZA1O0q5R/QF+iOtfBYzOERIQa+ gGTaOWJSoHPFeWAVYl72KPBveQjoAUI2NZXvnOPwFJ/vbJjOBRQXLBQcDewuQ75qV7mQ 0K4/UJJy/MI315q6p3rLQRPJi9fq0d0uBy4tgmycFOxT6O0yNBMFJmdayM/yXI34fUeD Myf/GciNOWVC8bKKuK2LyNrpWen5MyJpV0gFm8aZORV8fS2tVLPBG/SAB3+uJIA59+JJ LcYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=CiPRLrpS; 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 c187-20020a6335c4000000b0052c73bff109si1093309pga.95.2023.05.03.11.20.39; Wed, 03 May 2023 11:20:54 -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=CiPRLrpS; 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 S230030AbjECSIV (ORCPT + 99 others); Wed, 3 May 2023 14:08:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229926AbjECSIQ (ORCPT ); Wed, 3 May 2023 14:08:16 -0400 Received: from mail-yb1-xb31.google.com (mail-yb1-xb31.google.com [IPv6:2607:f8b0:4864:20::b31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03A816E81 for ; Wed, 3 May 2023 11:07:55 -0700 (PDT) Received: by mail-yb1-xb31.google.com with SMTP id 3f1490d57ef6-b9e2b26b132so3191233276.1 for ; Wed, 03 May 2023 11:07:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1683137275; x=1685729275; 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=lYpn5fAZ9k+tc7itapEv1evmei0G939nEHfVs4IvTnU=; b=CiPRLrpSjqW+fOh4MZzhage7DRZ0A4p0DiZA5jkP6SoRdijKTb12IH8HPYoav3LVEG UxuWUsJ8XzpNsPDm/IXDURhwANLIszVcD7BHVZWpxKR8Cw0scnMG0+3659JdLK1Cnzbt gTx327NEx/KsnLGXWD2bm6c3nHMqUhK1ehp/AZAyLh+gV85XesNeu4FfbGmllcRcS3lj 8b1rxia0KH86OKF4Rdr+PF90kA/tWE7FmwRSBvJAJbjNt9nt9Qc9maZ0a63/0iDWxZfb BP/YCRNb1VC6qYWZToRLJOzAfLm4sCL3eqAVGEOxe8HA1U7xEqqPmLc8gyCiBCpRmk5A q7WQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683137275; x=1685729275; 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=lYpn5fAZ9k+tc7itapEv1evmei0G939nEHfVs4IvTnU=; b=e45v3Q+vN2S+jFXV9hjZKRgPrL9aR0d/kZHlydffC3SM/VkccebnKN5nHojSb1Tq7z Fwo/jvjrbn49k/Fc96nWSd19AwoHUwf+p8/1AHczI2ki8xTlH6gyiMV0yh298ynOVnx0 V9BU78KAb7vZC7fQdvDW6GX6TT2llRy95rueHs4u7322J0CRQQQR/VTvV/P9XINHiGoL IwHMk9by5cMPOBwMeDyiIZF5TR+Uma4srCX6Ob/4t91E5HitjYcuOWk5W22qVZXRXGqA xGD6lKX57e0fwKzNsicXLyG9NX+5HKJ1R+Mk4rRjfIDBHM6xEn+EwdjgA5inoCK3TsZO peIQ== X-Gm-Message-State: AC+VfDzCaR3sJFUuv56R8pC4ZxQ7p7Ns1Pu/VPKzOe0pjjLvay4a/1xr euHIyJv2/b1qVBbxv4jQ3oWJEJIESVIMbCq3m7HZ+w== X-Received: by 2002:a25:160a:0:b0:b9e:2697:9d96 with SMTP id 10-20020a25160a000000b00b9e26979d96mr9339675ybw.3.1683137274526; Wed, 03 May 2023 11:07:54 -0700 (PDT) MIME-Version: 1.0 References: <20230501165450.15352-1-surenb@google.com> <20230503122839.0d9934c5@gandalf.local.home> <20230503140337.0f7127b2@gandalf.local.home> In-Reply-To: <20230503140337.0f7127b2@gandalf.local.home> From: Suren Baghdasaryan Date: Wed, 3 May 2023 11:07:43 -0700 Message-ID: Subject: Re: [PATCH 00/40] Memory allocation profiling To: Steven Rostedt Cc: Michal Hocko , akpm@linux-foundation.org, kent.overstreet@linux.dev, 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, 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 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 11:03=E2=80=AFAM Steven Rostedt wrote: > > On Wed, 3 May 2023 10:40:42 -0700 > Suren Baghdasaryan wrote: > > > > This approach is actually quite common, especially since tagging ever= y > > > instance is usually overkill, as if you trace function calls in a run= ning > > > kernel, you will find that only a small percentage of the kernel ever > > > executes. It's possible that you will be allocating a lot of tags tha= t will > > > never be used. If run time allocation is possible, that is usually th= e > > > better approach. > > > > True but the memory overhead should not be prohibitive here. As a > > ballpark number, on my machine I see there are 4838 individual > > allocation locations and each codetag structure is 32 bytes, so that's > > 152KB. > > If it's not that big, then allocating at runtime should not be an issue > either. If runtime allocation can make it less intrusive to the code, tha= t > would be more rationale to do so. As I noted, this issue is minor since we can be smart about how we allocate these entries. The main issue is the performance overhead. The kmalloc path is extremely fast and very hot. Even adding a per-cpu increment in our patchset has a 35% overhead. Adding an additional lookup here would prevent us from having it enabled all the time in production. > > -- Steve