Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp713009lqp; Fri, 5 Apr 2024 06:50:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXcoTmtAkhB6PwHzjMz+lmBMxJNWTo6ewMAsmLNvKX4FBjqeSUjVFKpdyKSm64CLTpPr5rbEev1V3NbvhWcHod1powZHhQFfn8Ms4bqpg== X-Google-Smtp-Source: AGHT+IHQWdlcljNr2KCDTuz6mZI39TETpDNneW6xdqg7seFH0FjWAbwhXA7QaH+77g27aA66Gkmj X-Received: by 2002:a05:6a20:2ca7:b0:1a5:6f7e:3b81 with SMTP id g39-20020a056a202ca700b001a56f7e3b81mr1250021pzj.41.1712325055242; Fri, 05 Apr 2024 06:50:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712325055; cv=pass; d=google.com; s=arc-20160816; b=lbnaEZnVx+lMv/O1ctnvcdHWYkRKp/mbyWqI/ncd5NtYt2B4ydwxtJzT6HPny4ibaE SX3XWNUWplUPswcOAMrfKQhIufgE/ZrDUyZjZbtY6MfJI9kk8/TIvgCIqlUh2quzNnB7 Jm3+bAB0cA2DZGO/9cHiVM6TnBjSTcpup/zPzxyTW3zRcKC09ZtIpaqknAq8Sh95aXXR PWD0yxemaRBKXURNMvBHljwJh32jEZBTXs2jTdof1n0EIAyuGI6Yh5Qe3wxnbKOkgpK+ 9WzMJDumoiLzOE/zcktLMVX6hUykBOoSqly7Mh5N5TxpUibRubTmCxjJDlYir8MTLysq SdXw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=eeNIVwqmbnOxALTxtADLGm9TG4sDVgGYt1HYshiYKqc=; fh=UhiNPebLF6hNz5gOwp1YWGN2qmqBYZ9iN8TPCTqGYTc=; b=BISdYCSlf7MF1qqyEkoFLaqsLtQoepwbEa+iY9T85KOsCXW6Cz/zSPjNeXIpM8OoIQ 7vJ+6dLN3BoLPmaenRh5X/VjBnTHrsX49Y0cUtAXZYw0qqrRoeIbQekwJ+60VCSC2xA/ eU/5RNbPsttJcjWEZHNin9YsXa8HsMUsgnr18TteTljdbWmiY0j0ZneBOKkHc91xgi4f BJduzHgT6UvyUlHTa88ULP1+u9PPuMP6GbbuQry2yieTLI78Q6+GJ6oY0jOKXPjZJV21 BTEQFAzr6MLGQiL3V/gmv/9Bijg2/PWPp9eSJ3q8wnSVJG6ck5rxhoj5PBIXBg++K/uZ f/SA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=u5ed4rhu; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-nfs+bounces-2664-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-nfs+bounces-2664-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id b13-20020a63d30d000000b005cdde899923si1368516pgg.758.2024.04.05.06.50.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 06:50:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs+bounces-2664-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=u5ed4rhu; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-nfs+bounces-2664-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-nfs+bounces-2664-linux.lists.archive=gmail.com@vger.kernel.org" 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 7A337B24699 for ; Fri, 5 Apr 2024 12:44:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A8ECE16C86F; Fri, 5 Apr 2024 12:44:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="u5ed4rhu" X-Original-To: linux-nfs@vger.kernel.org Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 A19A216C86E; Fri, 5 Apr 2024 12:44:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712321074; cv=none; b=JL6CT3KnKeEHQEfUDLZpGx4hrZTfnu9yatKQJdugl4O9oXRaON1vNF059dJPZYPpv/YIZN+M7QZHFJXHwQMSORLbolxKO4/DVUsYGXROFRSpLj7rWXSt9qgjhc7ujyNQCMsnoD5zHdR7mtVMZFkR4hAUuRnHkTbVxjjR/9L39GY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712321074; c=relaxed/simple; bh=hmp72QspsqQzNfL1h/lUM6waz79GdMoYXwuNVIfb0JI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=N+/SOHK1mX6+y2umx4fy3toiLkcR++8j+vPQejn8S78/hrqGZ1L5wqrbTKXfwMwmUboGz2Q58qXASnl6jSwA/c8173nv9BJeFTDOThPQMvvyQ34LgwWG7FosT75riNskYp3XtF27MUievFsJkkXhtVszwfk9W/6b4Aa/7gyk32Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=u5ed4rhu; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=eeNIVwqmbnOxALTxtADLGm9TG4sDVgGYt1HYshiYKqc=; b=u5ed4rhuZriAmkiqPN+PL+siyW LqRb4vlEwDanh3tAUYLOdMIV7AkIlisbY/us6TAVJuto+5fuwLvpi9TPIrnjWbaPPJNccNZW+iz9n CE7C1RkLY5MAKN+mK5a2RxNIgLnodNe3aX7iDp0V7aCmr5P/N6ISdHIVtmL/cESx2/auaAWvOPmPb KuyRV5Y+LQqQCk5pQAdOvh7O24Xw0aWYZroHPNWg+x3RZAuUdwa4MbZzNihetVBFDxn0z1t842ZIz FOV6F7MyMIx1gNWKJJYhVEkf93kF4Zc6qtlbIo+KLHjWxeAtAZV2JO/tPX3rOWtiHHQwKzPY7f2Nl e0gCTrgg==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsivU-0000000AUMn-1hDK; Fri, 05 Apr 2024 12:44:12 +0000 Date: Fri, 5 Apr 2024 13:44:12 +0100 From: Matthew Wilcox To: Kent Overstreet Cc: Andrew Morton , Suren Baghdasaryan , joro@8bytes.org, will@kernel.org, trond.myklebust@hammerspace.com, anna@kernel.org, arnd@arndb.de, herbert@gondor.apana.org.au, davem@davemloft.net, jikos@kernel.org, benjamin.tissoires@redhat.com, tytso@mit.edu, jack@suse.com, dennis@kernel.org, tj@kernel.org, cl@linux.com, jakub@cloudflare.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, vbabka@suse.cz, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-acpi@vger.kernel.org, acpica-devel@lists.linux.dev, linux-arch@vger.kernel.org, linux-crypto@vger.kernel.org, bpf@vger.kernel.org, linux-input@vger.kernel.org, linux-ext4@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, linux-security-module@vger.kernel.org Subject: Re: [PATCH 1/1] mm: change inlined allocation helpers to account at the call site Message-ID: References: <20240404165404.3805498-1-surenb@google.com> <20240404154150.c25ba3a0b98023c8c1eff3a4@linux-foundation.org> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Thu, Apr 04, 2024 at 07:00:51PM -0400, Kent Overstreet wrote: > On Thu, Apr 04, 2024 at 03:41:50PM -0700, Andrew Morton wrote: > > On Thu, 4 Apr 2024 18:38:39 -0400 Kent Overstreet wrote: > > > > > On Thu, Apr 04, 2024 at 11:33:22PM +0100, Matthew Wilcox wrote: > > > > On Thu, Apr 04, 2024 at 03:17:43PM -0700, Suren Baghdasaryan wrote: > > > > > Ironically, checkpatch generates warnings for these type casts: > > > > > > > > > > WARNING: unnecessary cast may hide bugs, see > > > > > http://c-faq.com/malloc/mallocnocast.html > > > > > #425: FILE: include/linux/dma-fence-chain.h:90: > > > > > + ((struct dma_fence_chain *)kmalloc(sizeof(struct dma_fence_chain), > > > > > GFP_KERNEL)) > > > > > > > > > > I guess I can safely ignore them in this case (since we cast to the > > > > > expected type)? > > > > > > > > I find ignoring checkpatch to be a solid move 99% of the time. > > > > > > > > I really don't like the codetags. This is so much churn, and it could > > > > all be avoided by just passing in _RET_IP_ or _THIS_IP_ depending on > > > > whether we wanted to profile this function or its caller. vmalloc > > > > has done it this way since 2008 (OK, using __builtin_return_address()) > > > > and lockdep has used _THIS_IP_ / _RET_IP_ since 2006. > > > > > > Except you can't. We've been over this; using that approach for tracing > > > is one thing, using it for actual accounting isn't workable. > > > > I missed that. There have been many emails. Please remind us of the > > reasoning here. > > I think it's on the other people claiming 'oh this would be so easy if > you just do it this other way' to put up some code - or at least more > than hot takes. Well, /proc/vmallocinfo exists, and has existed since 2008, so this is slightly more than a "hot take". > But, since you asked - one of the main goals of this patchset was to be > fast enough to run in production, and if you do it by return address > then you've added at minimum a hash table lookup to every allocate and > free; if you do that, running it in production is completely out of the > question. And yet vmalloc doesn't do that. > Besides that - the issues with annotating and tracking the correct > callsite really don't go away, they just shift around a bit. It's true > that the return address approach would be easier initially, but that's > not all we're concerned with; we're concerned with making sure > allocations get accounted to the _correct_ callsite so that we're giving > numbers that you can trust, and by making things less explicit you make > that harder. I'm not convinced that _THIS_IP_ is less precise than a codetag. They do essentially the same thing, except that codetags embed the source location in the file while _THIS_IP_ requires a tool like faddr2line to decode kernel_clone+0xc0/0x430 into a file + line number. > This is all stuff that I've explained before; let's please dial back on > the whining - or I'll just bookmark this for next time... Please stop mischaracterising serious thoughtful criticism as whining. I don't understand what value codetags bring over using _THIS_IP_ and _RET_IP_ and you need to explain that.