Received: by 2002:a05:7412:2a91:b0:fc:a2b0:25d7 with SMTP id u17csp733908rdh; Wed, 14 Feb 2024 09:41:50 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU6o5n0H8AGBK4QpxuKeW1N4g5jcLX9KYRx9fO+gegGJBbF3Qj85bV8iume8FzFtGoU2Clwj0NR/g5BFteO1k1A3yoVYJECMSY+ijyNzA== X-Google-Smtp-Source: AGHT+IGR94Odp0Y4RyTbX2evLaxU06IcaKNzkbz3Snsp2nE8U6KEC3bujpKhYDVDQuLhHLUWpb3R X-Received: by 2002:a05:6a21:9209:b0:19e:367a:2ca9 with SMTP id tl9-20020a056a21920900b0019e367a2ca9mr3942706pzb.8.1707932510528; Wed, 14 Feb 2024 09:41:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707932510; cv=pass; d=google.com; s=arc-20160816; b=N9GUNYeymn18yCIZ8nmHqAlGlEWVLRRceic2u2EjXmePviymof3OTIdmHQYOcO4UBp dwFHdfN77ZKY0oixuaTkz5iXbMIAL/Yglgco4ejkU0x4YA9kVDcQBHFh6Gsz3fLr/tiV IBLJhXu0MJKLb61xM6DTHJNYUSrN78hBUh8QqFubsTYw+w9ExlHic+6PoJpCrJSzm9KI ZtsfAgEqMRHKdy//M2bUM8mPoZj2mlhcm3+PkfPX5OOJtBYp3v4Sc30gS117TIzjxlbK 99UxzyGbyR/i5g5LcPXYpffGEmwElcD7RohmIByMnWOCw9OMCnWYJU4DDB458BSn+6pm pBrA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=LDg0vk5u/oyOZlQ8e31c3DglAzpuw7KxG8umDKGdfj8=; fh=XmMpMVepaLrdK+OsHiwn3Ah9o3PNvXZQxqpzQX7/SZ0=; b=g20T4jTtFwiwOAeg+tn88QQcLKTjzGBoprgFvxtRhPdUDGMypGTXiCCc1AjRS1HxOk cX015EzH0fSdT0pXGH1ERWUCNlOOORRCkhhH0dMD3cIyeAkRYs2O857X/1b5Dci5o2k7 4Lnsu1GCYplr6/deggi1sVL2DVcbHGFLEZoT4MAvIiTndRaqTGo8HmlpSOlho5LLXwP0 KozUfDXuiyhyv1utK9e1MDfbfLI7nvktAsXqRFi+ALa51c95ZW5Ab4m6ZrGLTssaJotT 7oBYEkf96moeeEbrQijTTnaXp5QpcUrrI5KOtL/oyIL8j6myfqzyHKaj96wvLtlyG6Qa dp/w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=Sj6nCkcu; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-65631-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65631-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com X-Forwarded-Encrypted: i=2; AJvYcCUpf/UEqgQH5hIRQbUdplr42Hi0fHqzKrbWBrdeFBYJNRbcd0TswpCQHd9VJpBqVWSy90b4WH7stR7p8aUab4reOb5RiGxGmGxSHXyQ3w== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id s11-20020a65690b000000b005cdf992367dsi4098198pgq.730.2024.02.14.09.41.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 09:41:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-65631-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=Sj6nCkcu; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-65631-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65631-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 3F8A1B2A85E for ; Wed, 14 Feb 2024 17:15:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2C1437CF06; Wed, 14 Feb 2024 17:15:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Sj6nCkcu" Received: from mail-yb1-f174.google.com (mail-yb1-f174.google.com [209.85.219.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 20D047C0A2 for ; Wed, 14 Feb 2024 17:14:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707930901; cv=none; b=U24mQsbCs+S1Il1Z/4M76T0Ii+NDFyVTiFjo+BQCOrGi88/DixUNkwVHpRQ31YAGHhQGJglC6/T8jxCr2DEbNek18zw1HcRMwMj4fI9I+SlvQVKHNU1rIzToMgdwx8a+0MpU4yKXOk1LjWIGB+mFqfxfSEn8bDQcS0L2tQglFXw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707930901; c=relaxed/simple; bh=sPCot6JJr6K4Y/nDZ6Ug5FbtqBuDWyih5na/iBbRBjk=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=nUl13Qv6nxZxBALd9QnA5tzl8OrlFfEb/kTGXEa7JD6H5FcGpUk3PFLUGAirSdung+yguJP2cSlQzc0dhira46dISUmX/LrJEXY3Aqx2QQs12o9K85zncD1M9VeI0pJ+i9vzyojzzZ29UQtZ18bvTnW+EFQQCDG9xF3acrtD1zo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=Sj6nCkcu; arc=none smtp.client-ip=209.85.219.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-yb1-f174.google.com with SMTP id 3f1490d57ef6-dcbcea9c261so2987470276.3 for ; Wed, 14 Feb 2024 09:14:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1707930898; x=1708535698; darn=vger.kernel.org; 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=LDg0vk5u/oyOZlQ8e31c3DglAzpuw7KxG8umDKGdfj8=; b=Sj6nCkcuvdkrrPfRVep8I8nY+W4bKwJ0JRq25VZVF0Ku8M8lr4MbFQrNhGaM5+aNSr 0k9vsUH0ezeX8s5zkCaO42Gb5ToeSQqbzfMzlBDfmiJOAmn5jr+dSfIWC2SK/nSNuoUT A/iv3na+rKVxtNL7gliH0ImBMDbcT2L1aUuDh4+HcZFl3C+eSapdhHLTCaN72t+YynLt 94acJV0SFOK5SuajIxIyNNibpk086Q5AiN+nBFDZUYs1t6HBYcHgoYG1ecdeZT1rjm2e FLZqnL1/VNVJolPDkbw+jDay5tTqEYQB0B+NJf7q//dyMhgdYKJYewbqnv1t63xxxMKR 7l7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707930898; x=1708535698; 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=LDg0vk5u/oyOZlQ8e31c3DglAzpuw7KxG8umDKGdfj8=; b=SYly9PtH893XJQsNOX+kkDYZZYqpA0wk93iTQqIh7o3Ebx9DUtQbXR1VzZIMBdQlPv /BvZo0R1/XPy5ojxCG0x8lXBHK65sHODxjkgetJq89RqS3jyDEN4FaV8rIV2OlBTMtaD +8PUxxldFVftCr1IF2+3bhvByftFPQRjq+U0oUqapxZAYHal8AFnLHQOJuyLz04hkiQt 8nVRJ//ssrDocCYz8NsAxj67FYsvFe+2Vzp4fk2voud1rBIx9mD+fZBYGDdFqvTyF6pH QeyILHLHf34lC+v163/IAugm1Vv0wIeZntepfeIy3a62GCHXJg1Uzn5MEmobqHAU1WaX Ja9Q== X-Forwarded-Encrypted: i=1; AJvYcCW+NhwzLUjlztMtXqKJeuLG1BnxtOs1ofnW8y4DrBvJ1+xHQj7UILAb2edCWXw+hNajDYZVYdYa0BL/RpiNT2XLXKgHSWAm0Ijr9GO3 X-Gm-Message-State: AOJu0YzuXLp89FqzQf8lwhquhZqMH7EG7rqXJ3csjYdaqMpi74J5Gfag J2pKaGH8Em0Y+08FbYZHhZTOUfLJmxmruB25c4oaxH4CoNw88vfkFm/gjip4FqJ2gz8KbQe3haJ Dy2fdcpHvUYVlxxyMJPmkfdx2iyOBv2x7kBOo X-Received: by 2002:a25:7443:0:b0:dcb:e82c:f7d with SMTP id p64-20020a257443000000b00dcbe82c0f7dmr2936932ybc.41.1707930897779; Wed, 14 Feb 2024 09:14:57 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240212213922.783301-1-surenb@google.com> <9e14adec-2842-458d-8a58-af6a2d18d823@redhat.com> <2hphuyx2dnqsj3hnzyifp5yqn2hpgfjuhfu635dzgofr5mst27@4a5dixtcuxyi> <6a0f5d8b-9c67-43f6-b25e-2240171265be@redhat.com> <20240214085548.d3608627739269459480d86e@linux-foundation.org> In-Reply-To: <20240214085548.d3608627739269459480d86e@linux-foundation.org> From: Suren Baghdasaryan Date: Wed, 14 Feb 2024 09:14:46 -0800 Message-ID: Subject: Re: [PATCH v3 00/35] Memory allocation profiling To: Andrew Morton Cc: Kent Overstreet , 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Feb 14, 2024 at 8:55=E2=80=AFAM 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 a= ll 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. Sure. The compiler support will be in a form of a new __attribute__, simplified example: // generate data for the wrapper static void _alloc_tag() { static struct alloc_tag _alloc_tag __section ("alloc_tags") =3D { .ct =3D CODE_TAG_INIT, .counter =3D 0 }; } static inline int wrapper (const char *name, int x, int (*callee) (const char *, int), struct alloc_tag *callsite_data) { callsite_data->counter++; printf ("Call #%d from %s:%d (%s)\n", callsite_data->counter, callsite_data->ct.filename, callsite_data->ct.lineno, callsite_data->ct.function); int ret =3D callee (name, x); printf ("Returned: %d\n", ret); return ret; } __attribute__((annotate("callsite_wrapped_by", wrapper, _alloc_tag))) int foo(const char* name, int x); int foo(const char* name, int x) { printf ("Hello %s, %d!\n", name, x); return x; } Which we will be able to attach to a function without changing its name and preserving the namespace (it applies only to functions with that name, not everything else). Note that we will still need _noprof versions of the allocators. > > Who is developing it and when can we expect it to become available? Aleksei Vetrov (google) with the help of Nick Desaulniers (google). Both are CC'ed on this email. After several iterations Aleksei has a POC which we are evaluating (https://github.com/llvm/llvm-project/compare/main...noxwell:llvm-project:c= allsite-wrapper-tree-transform). Once it's in good shape we are going to engage with CLANG and GCC community to get it upstreamed. When it will become available and when the distributions will pick it up is anybody's guess. Upstreaming is usually a lengthy process. > > Will we be able to migrate to it without back-compatibility concerns? > (I think "you need quite recent gcc for memory profiling" is > reasonable). The migration should be quite straight-forward, replacing the macros with functions with that attribute. > > > 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? That's what I'm aiming for. I just don't want this placed on hold until the compiler support is widely available, which might take years. >