Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1194218rwr; Wed, 3 May 2023 11:21:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ47LIs5ui1RYUJ0mY4i/p0qDzxx73TxN2WAn8SC9O8cIWlbtY1sQDge431/Qz+qhsz5pBPR X-Received: by 2002:a17:902:f54c:b0:1ab:2669:b6c2 with SMTP id h12-20020a170902f54c00b001ab2669b6c2mr754950plf.28.1683138072376; Wed, 03 May 2023 11:21:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683138072; cv=none; d=google.com; s=arc-20160816; b=wVVWxuAWMilqq/s0pypKCcAlb9cE35m3Dj164slwGgPYSzG89BLxkMPl2q34qc3XSR GEEujTOYgmhXI1HwQNUh+ooRutaRMNE0Fr0TsHU+oylZ66DTpgBPGf1FzXrhKzimTCg2 kFcdHWc6rfybY60t87oNIxdPZOsuWuDP37R7eTXnI6gGPX6n+dF6LmHlE3QJsL+Rf0t3 oaCofw4GQSK801Wc5tPAenLIvnzjbFaRfTfyrmUWsqKnYNe9iEaknsjCK+1sNyjDTcF2 zQyEksFBeLhDV7m5XqCV1D6GwhltygdbRQ5YBwzquudXcAoP68248FkJR9DOnW4KlDvj GuAg== 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=bFNCoxPB6ZGjmPXwS7aActt9s9ZGw8uNq57D7UKDjKM=; b=LzTkOZgXQHQPo+sZj+uU9TUvyyAEWcBGygYYtGKX6gn4KjP0JVEL8ZAnFSttXjzDi0 +czTiFt4GFoM5HKUYwZSbSvi8KTrUirxt7Q6RAgdI7WilqScbfv/Me0eYcUEkDFW7pnz t6MPUX+NtCuKLNRFYWmbiZ4clbWVFP5TmWwR2hw0z5Rp/93EWWvVsmyvDyIOD2tJzgpN ms5co9f/QCRFZ4AqtDAheccjwOmZpba+8gjcuY/L50AkSmu0yNRtFANQjiMVlRq5ZLsW ZzQk9qwW6xXECtO3+Dyc/h8RRK9FCbsoDjnbF19FUVDpVTTgt8rc8ThS5R2LJTis8Yrt w/fQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=siD6Jyei; 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 z10-20020a170902834a00b0019ad22c40c7si180018pln.132.2023.05.03.11.20.57; Wed, 03 May 2023 11:21:12 -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=siD6Jyei; 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 S229837AbjECSNL (ORCPT + 99 others); Wed, 3 May 2023 14:13:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229720AbjECSNK (ORCPT ); Wed, 3 May 2023 14:13:10 -0400 Received: from out-55.mta1.migadu.com (out-55.mta1.migadu.com [95.215.58.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 820112129 for ; Wed, 3 May 2023 11:13:06 -0700 (PDT) Date: Wed, 3 May 2023 14:12:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1683137583; 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=bFNCoxPB6ZGjmPXwS7aActt9s9ZGw8uNq57D7UKDjKM=; b=siD6JyeicdLYm9Q2yXmRLr5ySGXSB2lV1k50m3UiM0GKRXv1RttykEM7dYP8xs5X197IgJ jBtAc6ZM4L3Wd+zT4HheIwdrdCZIcmEPDStAu9bPcBItsW2S45BekRwud2QX4sDZVSICcP fDDddqmELDDTv0N0zR7Bb5BfCgDoj40= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: Steven Rostedt Cc: Suren Baghdasaryan , Michal Hocko , 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, 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 Subject: Re: [PATCH 00/40] Memory allocation profiling Message-ID: References: <20230501165450.15352-1-surenb@google.com> <20230503122839.0d9934c5@gandalf.local.home> <20230503140337.0f7127b2@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230503140337.0f7127b2@gandalf.local.home> 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 02:03:37PM -0400, Steven Rostedt wrote: > On Wed, 3 May 2023 10:40:42 -0700 > Suren Baghdasaryan wrote: > > > > This approach is actually quite common, especially since tagging every > > > instance is usually overkill, as if you trace function calls in a running > > > 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 that will > > > never be used. If run time allocation is possible, that is usually the > > > 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, that > would be more rationale to do so. We're more optimizing for runtime overhead - a major goal of this patchset was to be cheap enough to be always on, we've got too many debugging features that are really useful, but too expensive to have on all the time. Doing more runtime allocation would add another pointer fetch to the fast paths - and I don't see how it would even be possible to runtime allocate the codetag struct itself. We already do runtime allocation of percpu counters; see the lazy percpu counter patch.