Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp40796rdb; Wed, 14 Feb 2024 12:02:07 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWWw+ZPVfvyEnOY4Etq6SJ6UNsYLYYLE7rs3DEsBuHiS5oPubYoOKLtu+vD9aTaI7dAQ1L7tCD032ktLad3jMNKYXSOvQi75WjjFws6Kg== X-Google-Smtp-Source: AGHT+IENe23T1BRS9OVw3ahvPazkrsi0W2eEnj/ZkjuZ3nGnBYOUTRlok9Kfrd8MK/kmdzEDSHoB X-Received: by 2002:ad4:574b:0:b0:68c:cdd5:64d9 with SMTP id q11-20020ad4574b000000b0068ccdd564d9mr4278875qvx.54.1707940927175; Wed, 14 Feb 2024 12:02:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707940927; cv=pass; d=google.com; s=arc-20160816; b=JUScCj4rruzKbmxwFhvGUYrOD4/HGvlkt7a2OFR1+SBbXPaLUQcyAcAbcZVh+jCkGF 1GTvmJVg+dyW5VFt/EuM0lmsC9L6gEcBFu/yh6IK8FbeztC+5yUSvruaiHG+jhhv8DOl EiOZsG4wULZ8b7OA4Nbs9inI+fQ1TfAQHoxY0z5NFAnfvDNfEE+YsGUHi9FTZPOz04Ns zfFP5EgcH7WBXdrNiY8KG6pyiE3Az8p8fPwooojazUg21WfDhQ5Hi1KssveYByGF2vkU qkN1LiBS9O8ER8TiWrztnpMrL1wCmUIf6SK1ka+cjHOIYdmH6U3Z+PsGB/jnlRupVfkJ SHOA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:dkim-signature:date; bh=pf30Mbuh5b/kObn023v7ccfUflKK/+7eCEEfg4Q4/Xo=; fh=sH5+pRfnHTM6UxTuzDsQzdJQeQbkYRdqP9/LC1oNXiU=; b=txue9u8Ndac2xdwDVDLHaOspb+ejPk95UPCS28wNdmwPWfGO4JBFgXcYu3xEP+ktwh bknjTaqPiZeaswx/ZzZp484Ap6LQTCRPw/J+6URftQeffrpgPZ62RpB0tysH7dNneuit NADLF5wp71qOfBAXGCFlqhlhf8UmWKhQIob+ydFpa9qRg5b+0Hkjs88qYYifN61zl1Hb PX7DXa0kIOOngnUUydwr+u3SK2RDqWnTQHJ/VdoYhcPpz7jLHr9nvUfqzVj/H0Df5FVx HNCJL5P9jP3MNWnN2yD+oSsSqLGIAO80wwfgjeibNNsJ0N8rhkwVwBIYkd5Ch0igCs2q Ybeg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=V0Dtva7q; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-65909-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65909-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev X-Forwarded-Encrypted: i=2; AJvYcCVpGZTTwX60SjUlOkd3vtNHyrtmqth9BFC2qVGXYzaE6EWCr/Xwby6SK5OW+5BMtBxHpoHaaJZYvbZ7x1gDqIThadyj3RqLdofCGh0VyQ== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 2-20020a0562140dc200b0068eeff8b49esi4432888qvt.137.2024.02.14.12.02.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 12:02:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-65909-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=V0Dtva7q; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-65909-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65909-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 6EA0D1C268A6 for ; Wed, 14 Feb 2024 20:00:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 93B8C13DBAE; Wed, 14 Feb 2024 20:00:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="V0Dtva7q" Received: from out-182.mta0.migadu.com (out-182.mta0.migadu.com [91.218.175.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BB57813DB8A for ; Wed, 14 Feb 2024 20:00:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707940830; cv=none; b=bO14oa86pBgglrR1F6TtrhnWAJ8I1iroWLXaFCHKdXuviU0l86GRFS0gmyBTCnB7CjeJd/reuq+F31A0DiN9yMvlPMickIhTeC4/9jblxRFbSuq8vN8x/PWq9MJIDsjJDgmaNo++oycWeDRqQNQ1ujOrWa2cV8n/4bKGRAOzJFk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707940830; c=relaxed/simple; bh=sG1eMeXm6V7HoOMCkcfIrnxVJDrJycSjo8dnKLtS7so=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=MCtzN1b863GxrVUAJ34dALCed6igDnjlUabQIxRFxGntMsxxhbz7yDzKx8gHfmyWEkyL4J1ajio/GVr6/y75woe4U2LyrzhkY4WrlE+KudH6ivV2GHrifxcmXeMdd9p58WIEl0V8GgkYx4LfDBkRjt5wrTO3JVnx0kBa72YrmNQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=V0Dtva7q; arc=none smtp.client-ip=91.218.175.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Date: Wed, 14 Feb 2024 15:00:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1707940826; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pf30Mbuh5b/kObn023v7ccfUflKK/+7eCEEfg4Q4/Xo=; b=V0Dtva7qS2reHkZJi6PJ+HEovBCR0hF1cHRtyU3vqEVbBd8vXfQIrh8jm2X0ifBBI4P+IO H5vrvDEyaz0upotCLVyuYanif0dGbMLFqnWADl59CQ4rEdihhMwhzsvSw9R6sR/elwVruF 7JlRVAQ9ZPkvUkS27LLag/qy7F3NQ4g= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: Suren Baghdasaryan Cc: Andrew Morton , David Hildenbrand , Michal Hocko , 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, 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, 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, vvvvvv@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 Subject: Re: [PATCH v3 00/35] Memory allocation profiling Message-ID: References: <9e14adec-2842-458d-8a58-af6a2d18d823@redhat.com> <2hphuyx2dnqsj3hnzyifp5yqn2hpgfjuhfu635dzgofr5mst27@4a5dixtcuxyi> <6a0f5d8b-9c67-43f6-b25e-2240171265be@redhat.com> <20240214085548.d3608627739269459480d86e@linux-foundation.org> <7c3walgmzmcygchqaylcz2un5dandlnzdqcohyooryurx6utxr@66adcw7f26c3> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Migadu-Flow: FLOW_OUT On Wed, Feb 14, 2024 at 11:24:23AM -0800, Suren Baghdasaryan wrote: > On Wed, Feb 14, 2024 at 9:52 AM Kent Overstreet > wrote: > > > > On Wed, Feb 14, 2024 at 08:55:48AM -0800, Andrew Morton wrote: > > > On Tue, 13 Feb 2024 14:59:11 -0800 Suren Baghdasaryan wrote: > > > > > > > > > If you think you can easily achieve what Michal requested without all that, > > > > > > good. > > > > > > > > > > He requested something? > > > > > > > > Yes, a cleaner instrumentation. Unfortunately the cleanest one is not > > > > possible until the compiler feature is developed and deployed. And it > > > > still would require changes to the headers, so don't think it's worth > > > > delaying the feature for years. > > > > > > Can we please be told much more about this compiler feature? > > > Description of what it is, what it does, how it will affect this kernel > > > feature, etc. > > > > > > Who is developing it and when can we expect it to become available? > > > > > > Will we be able to migrate to it without back-compatibility concerns? > > > (I think "you need quite recent gcc for memory profiling" is > > > reasonable). > > > > > > > > > > > > Because: if the maintainability issues which Michel describes will be > > > significantly addressed with the gcc support then we're kinda reviewing > > > the wrong patchset. Yes, it may be a maintenance burden initially, but > > > at some (yet to be revealed) time in the future, this will be addressed > > > with the gcc support? > > > > Even if we had compiler magic, after considering it more I don't think > > the patchset would be improved by it - I would still prefer to stick > > with the macro approach. > > > > There's also a lot of unresolved questions about whether the compiler > > approach would even end being what we need; we need macro expansion to > > happen in the caller of the allocation function > > For the record, that's what this attribute will be doing. So it should > cover our usecase. That wasn't clear in the meeting we had the other day; all that was discussed there was the attribute syntax, as I recall. So say that does work out (and I don't think that's a given; if I were a compiler person I don't think I'd be interested in this strange half macro, half inline function beast); all that has accomplished is to get rid of the need for the renaming - the _noprof() versions of functions. So then how do you distinguish where in the callstack the accounting happens? If you say "it happens at the outermost wrapper", then what happens is - Extra overhead for all the inner wrapper invocations, where they have to now check "actually, we already have an alloc tag, don't do anything". That's a cost, and given how much time we spent shaving cycles and branches during development it's not one we want. - Inner allocations that shouldn't be accounted to the outer context are now a major problem, because they silently will be accounted there and never noticed. With our approach, inner allocations are by default (i.e. when we haven't switched them to the _noprof() variant) accounted to their own alloc tag; that way, when we're reading the /proc/allocinfo output, we can examine them and check if they should be collapsed to the outer context. With this approach they won't be seen. So no, we still don't want the compiler approach.