Received: by 2002:a05:7412:2a91:b0:fc:a2b0:25d7 with SMTP id u17csp224716rdh; Tue, 13 Feb 2024 15:09:54 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUBoMdiw5vnRfnHIIM5E3mFwXID7FwnwZ8dCkQVH3TOJmBdBmXShxwhbQB4FYMViOyP4IxxD0XQkqyKA7CT6akH2jUWnGy+etE3eV/WoQ== X-Google-Smtp-Source: AGHT+IHhSzDAZy8JkHuU7a+vZDe0A9KRRAHmPS9jio3PLDsLPeEobK2JQlCPJtp8vGgrmOYKRqdg X-Received: by 2002:a05:620a:109a:b0:783:ca94:59d7 with SMTP id g26-20020a05620a109a00b00783ca9459d7mr536184qkk.30.1707865794292; Tue, 13 Feb 2024 15:09:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707865794; cv=pass; d=google.com; s=arc-20160816; b=RTHaHFfIMnxWqiWre67+O/dwiTPrg9MgwlVUrOdFYLu0f/03GE3i1dVs+06g5paiLU SflAd4Y0sCe7kWV7veiTtjlips7uObimX9yjKzJWFuILFEheMBRcKa63bhIpA4tBgWo7 j/KNBiDJdRu6aZoQxUiU7q9y6vP0eA3vyKwX8C8auAw/yBT23cqDgYq2/sfxAqmbsNg5 SfIYxOMEJ3BlBC6LCKuRqTgZKS74wFgDSrSyzcRFgSSiACji6V/HjGft0lloSsmtf7mW veyff3dS6JpLT5OCQqZ1y+kWjd6VRVNU4KhksnuJxWxNJBu87YTlQNdjnvjQAM6kNfWL +elQ== 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=Mzqjn1+my5U+9pn6lTJcYt1NGpNIWi5Z/k5UXgeN0+U=; fh=bza6Inx1nWnXlbtKrdYgdWKmHOCtkOc/XeqJqu6NjkI=; b=RXzO0Ys3ZpTuaewjuXbUzHsqiHbmGq4+r1Ros+6rHKWBgVmsPGR/MNIhFJAwC5zaKc gOaR/szzOyUtB9LcuGtVQ3DIGPrXq324qcIwidyklEW6kMztSJW5M5mlA2HAQ549zDJ8 hYeftGrZ8cCVFGqAR0BPRvOUZemyKwhw11qIur+bfxyyxDJNF0bRlT0TeDRWnNMWX/Sm x9+fUW0Wae2g4OOdzC0dZp5qeqqY+Q340pKgDv2zHnGR+1OaCQTJWXGlHPfSV9L5fePU HaxXMF1Pt/Lb1gYmSRmvdw7cypENAxrJOT/UvsHz2wVAlkF9hpFA0xMBAWNsbCWmfG8M AT7g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=fgDMRJQx; 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-64512-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64512-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; AJvYcCVJMq60Jz9eTWh5WHwpDODj/PKY1HiP5g7jBrRiMkl7u/u/XciYcCS48MDSImzd+bOXc6BeFvygZ7eXkhedGLNiMHsgHPlvFA59LQ/Pyw== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id po30-20020a05620a385e00b00785b189cc93si9314237qkn.353.2024.02.13.15.09.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 15:09:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-64512-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=fgDMRJQx; 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-64512-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64512-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 12CB11C27C15 for ; Tue, 13 Feb 2024 23:09:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 13BCB6340F; Tue, 13 Feb 2024 23:09:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="fgDMRJQx" Received: from out-176.mta1.migadu.com (out-176.mta1.migadu.com [95.215.58.176]) (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 6026A63130 for ; Tue, 13 Feb 2024 23:08:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707865740; cv=none; b=QpcwklJ68GVfPJkN9WWYu9HATOJW07Ja4XDy2eLxdt/Ni9ceiMdqLXdEvfu6pT/FscXfjOpyG/SElljqvBfYZqpPSZkpXLx/x8EPKpJzCCz9h/CALcInpnYR4H40tmFZynkrSYYex0JsFklh+74K3y8cQhLwsHYtDJ9dpjowh08= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707865740; c=relaxed/simple; bh=oSEYpaQQXIFBmm8j7pPX8SQEbcBxd6Q82+KoVb/vVlc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=khVA1UO8XeLe3k2A5KtATNmrmft5z/FWRbPVsvCY4NLjGF+SCGkveTYJBavjyIoVNzDOEs7qYtZDDqkDRcP7NWyoM7En1phiKCK3GPlz81u+kedEKDT3+2C1TY770UxtNP6ISY3B3M8rGN6d4PLYxiCnSqG1C9vXBTMhj+xGVsI= 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=fgDMRJQx; arc=none smtp.client-ip=95.215.58.176 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: Tue, 13 Feb 2024 18:08:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1707865736; 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=Mzqjn1+my5U+9pn6lTJcYt1NGpNIWi5Z/k5UXgeN0+U=; b=fgDMRJQxyg5ZaQ70wbvauQeVygT0FUfeMQ0qsWNmo4yVngfupLaBrifbmmB+NDciVw113f tg8T47r7vMzyQ7sfjXo6vLQrPP7wW35nMBVJrJoXBgP/YacFTsuXiEfZo2MVbtwEd3WQkY dJ6BjWexLTLrv4mambztuLxFKiGSJdE= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: Suren Baghdasaryan Cc: David Hildenbrand , 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, 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: <20240212213922.783301-1-surenb@google.com> <9e14adec-2842-458d-8a58-af6a2d18d823@redhat.com> <2hphuyx2dnqsj3hnzyifp5yqn2hpgfjuhfu635dzgofr5mst27@4a5dixtcuxyi> <6a0f5d8b-9c67-43f6-b25e-2240171265be@redhat.com> 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 Tue, Feb 13, 2024 at 02:59:11PM -0800, Suren Baghdasaryan wrote: > On Tue, Feb 13, 2024 at 2:50 PM Kent Overstreet > wrote: > > > > On Tue, Feb 13, 2024 at 11:48:41PM +0100, David Hildenbrand wrote: > > > On 13.02.24 23:30, Suren Baghdasaryan wrote: > > > > On Tue, Feb 13, 2024 at 2:17 PM David Hildenbrand 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. Hang on, let's look at the actual code. This is what instrumenting an allocation function looks like: #define krealloc_array(...) alloc_hooks(krealloc_array_noprof(__VA_ARGS__)) IOW, we have to: - rename krealloc_array to krealloc_array_noprof - replace krealloc_array with a one wrapper macro call Is this really all we're getting worked up over? The renaming we need regardless, because the thing that makes this approach efficient enough to run in production is that we account at _one_ point in the callstack, we don't save entire backtraces. And thus we need to explicitly annotate which one that is; which means we need _noprof() versions of functions for when the accounting is done by an outer wraper (e.g. mempool). And, as I keep saying: that alloc_hooks() macro will also get us _per callsite fault injection points_, and we really need that because - if you guys have been paying attention to other threads - whenever moving more stuff to PF_MEMALLOC_* flags comes up (including adding PF_MEMALLOC_NORECLAIM), the issue of small allocations not failing and not being testable keeps coming up.