Received: by 2002:a05:6500:1b41:b0:1fb:d597:ff75 with SMTP id cz1csp247518lqb; Tue, 4 Jun 2024 10:06:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVAr0inMza1i6wpqW+NcxkGjJf4UejiO9nU+xbPwTRPCHG4cmqtUl72fij0VNe2UtObKMCwrZ0JbMhIjsc6daA/QyB1q2UW1QvakxaE2Q== X-Google-Smtp-Source: AGHT+IEN6H1FRGyyyWhDs8nq+Fj7R7T4hxnkjwCD0TTHMcQWI924hS+Xq83hTOYKFQsu22wUHiGw X-Received: by 2002:aa7:88d4:0:b0:702:558d:33d4 with SMTP id d2e1a72fcca58-703e598ec28mr66935b3a.17.1717520793202; Tue, 04 Jun 2024 10:06:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717520793; cv=pass; d=google.com; s=arc-20160816; b=f5zwoFKz3dV1iq4bMn5hPANGG1o7QVmG7PTvGdqho7DjT0yM5BOOqAi+xZU9teRwpD OR/t6HYGU09XgPS3e5RktwHa4rVvsW1bCYxQaMXz1G/PqQ7VSPVUeZFs/OzGsEnWcwFB S4QN4EoFo6JJsn89TY4D1TBuYZN2NGA62tGHIbsS/uCNGjWr+UCoqEiWLWh3rO3Tq6bX Nx2yi4veqNh5iynQUYcpYKVlK1Qy1c2n9oKXKFehS04SfoMMW69XWMkxEHnj3w07b+ZP Iw4A+MuvS/aEH9UoqLUgsW3UxMF6S2Bqct+23caxL9QUARgZNrkq51q7IzAxTHVD5GKO +dCw== 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=EYr0Y7RICrMaykessJ15jPU9wen2fALKwAvygZWhRiU=; fh=Q1bgFY26pBoR5/mMMgZBzOjok5TJPud2U9WPQiV4Kns=; b=HngAktYoJPbGHsPSLGLAvrMqc9E58Y7e8eHCLKD5XJ7eM6jGeiSsJQJ2Ue071cFcL4 LM2DnE8uTJYQpcU1xCy/8073RNGKRpH9CQTwK/zaJg4+e6bNybaWqP/QDj+FIuyi0lWW 5AHMJNpTbK1KyScoDxjICumztI/a0TEt8DBp1HzvGFvgXgePh2hVQ6HMyySEkFklno3z 3rvcv0P+MgikpWTAndUt+O/Zq3eXokbzbk6DVsXFHHLmVZQplF8bLy10Zek/tiRBSTDi gqT71fy10ftGiyy9L1/loqpaYMcn3phWNJ/pDxwg8qskDXkTtiU0qsK1jvQ4OsGMAzhK LbjQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=HgXnE0hF; arc=pass (i=1 spf=pass spfdomain=ziepe.ca dkim=pass dkdomain=ziepe.ca); spf=pass (google.com: domain of linux-kernel+bounces-201079-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201079-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 d2e1a72fcca58-70242c293e0si2477489b3a.288.2024.06.04.10.06.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 10:06:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-201079-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=@ziepe.ca header.s=google header.b=HgXnE0hF; arc=pass (i=1 spf=pass spfdomain=ziepe.ca dkim=pass dkdomain=ziepe.ca); spf=pass (google.com: domain of linux-kernel+bounces-201079-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201079-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 51E5AB2A21F for ; Tue, 4 Jun 2024 16:32:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BB45A1487EA; Tue, 4 Jun 2024 16:32:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="HgXnE0hF" Received: from mail-qk1-f177.google.com (mail-qk1-f177.google.com [209.85.222.177]) (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 F36E31487FF for ; Tue, 4 Jun 2024 16:32:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717518726; cv=none; b=pE1hMx2mcIfJgc5iE/C/pzSm5Pea01t3OBKin798TZ1MDk3HtswJPF3U25X7YGNl18lGBLQu+yFxHs9LF0zIDEqzYz8FEhieoJvzLCuIxYpaxO0LiKVY+szy1zogjL0pkk8bVdX8Kg/5DUsQZwR/2APbah5CDvAsSlZcBl/j9Uo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717518726; c=relaxed/simple; bh=i4Ogx5/mcBgPe8sS8F8X3tQ7eWEg2sGB2TGn7q/9bMU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ZeE6guR7YRo8Bclxyepj2zzvnqr6fo1TpxMl2TlsvNVxHAyVki9FbdbeA0591MEfL1TBMwQHRYK7IxhdM1rmWqsM/2WN/HGvlRQ9+wlJvZNDXx7N7Q/NKGeHyWL1y8624y7K4ZjYdq/qrYIHMlcZlrdFugjGSjeAROswerOo9X0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca; spf=pass smtp.mailfrom=ziepe.ca; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b=HgXnE0hF; arc=none smtp.client-ip=209.85.222.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ziepe.ca Received: by mail-qk1-f177.google.com with SMTP id af79cd13be357-7951e24db3bso34289985a.3 for ; Tue, 04 Jun 2024 09:32:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1717518723; x=1718123523; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=EYr0Y7RICrMaykessJ15jPU9wen2fALKwAvygZWhRiU=; b=HgXnE0hFGN5LPcj1volHEzaktqS39wRLFKsfdPOjrGSzbcgM8iKqyoaryZ52o2p4vz Nqvfru5A3eCMEsddtspDtceHVmvigeqFj0/Ij/SWd9KTnXD3bn3UyKCelhqIg83GURRF fFg+ZD+ksUXGFmVvcZM3sQHu0HhfE3BnJEeapN441cKgo1NE6skc9DQJuhi8ACyH2mpO g7g7WrO8weGOIJ+4PgW52LK2eVAJR4zyWFW45r8R/V5Y79eksxGmoaNkh+uA5pmk4kNf qJ1+8x1GntZWXPuug9UqtquGS0oy8GcsbydN/4pkBCLAOHYhUNroafSvXiAUP8FEdYJq 2oBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717518723; x=1718123523; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=EYr0Y7RICrMaykessJ15jPU9wen2fALKwAvygZWhRiU=; b=gVS76MK+gpemVNp55s1T8pIcAbvfXmBM6MrjLeOOdentBMHjlU3/bMeteWYcobuTV0 Ull3ovSyDju8yakUH52Xm5hdq4fxPDjRgi76gDiTROFZ0z8gGr3p9A/9opVk7EnSWWRp Bw13uxcqTKmRX0vZDPpu16R0pecx88g4e7iZIqgKQGjdWvnRnpHDJnbdcyQBRm5EH44h +Vii8b3jAHmhjEXGl0vI22QNuxgTwP5C9WeaIhhbgNzmUG8YKZV7ev8PAUeeKDFHHX7n 4R4QgJv8FZMPiePWdVHzM1cyZgwkjgZTmqojhmVpavJ6IBL/nw0QmscYDY9TZxg/g7mb gKjA== X-Forwarded-Encrypted: i=1; AJvYcCVIYlQA8VaXxf/IZOzpJkajp1ZXgp8IQFPpVW5VIuyBJ1k/iNjtOn0fSlOJJxQ5B9LxUGpByGe5Cx2PxWxj/IYoMf2nCydd927nPGaQ X-Gm-Message-State: AOJu0Yy0O4kwzfe2LHXAX+OKO7W85jjciXBQBGbmYYvSIepHlFjljORf 6ZQ/i7lPDZsX+IGiAm/PmElDhvaMqLvykskLO5cxtoQYevOf9ELpzbQOe4FzqVQ= X-Received: by 2002:a05:620a:271a:b0:792:c5c7:e90d with SMTP id af79cd13be357-794f5cc687emr1510000185a.49.1717518722779; Tue, 04 Jun 2024 09:32:02 -0700 (PDT) Received: from ziepe.ca ([128.77.69.89]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7951a7b3314sm48813285a.40.2024.06.04.09.32.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 09:32:01 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.95) (envelope-from ) id 1sEX4o-002rQm-Kw; Tue, 04 Jun 2024 13:31:58 -0300 Date: Tue, 4 Jun 2024 13:31:58 -0300 From: Jason Gunthorpe To: Steven Rostedt Cc: Paolo Abeni , Mina Almasry , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-alpha@vger.kernel.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, sparclinux@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-arch@vger.kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Donald Hunter , Jonathan Corbet , Richard Henderson , Ivan Kokshaysky , Matt Turner , Thomas Bogendoerfer , "James E.J. Bottomley" , Helge Deller , Andreas Larsson , Jesper Dangaard Brouer , Ilias Apalodimas , Masami Hiramatsu , Mathieu Desnoyers , Arnd Bergmann , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Steffen Klassert , Herbert Xu , David Ahern , Willem de Bruijn , Shuah Khan , Sumit Semwal , Christian =?utf-8?B?S8O2bmln?= , Pavel Begunkov , David Wei , Yunsheng Lin , Shailend Chand , Harshitha Ramamurthy , Shakeel Butt , Jeroen de Borst , Praveen Kaligineedi , Willem de Bruijn , Kaiyuan Zhang Subject: Re: [PATCH net-next v10 05/14] netdev: netdevice devmem allocator Message-ID: <20240604163158.GB21513@ziepe.ca> References: <20240530201616.1316526-1-almasrymina@google.com> <20240530201616.1316526-6-almasrymina@google.com> <20240604121551.07192993@gandalf.local.home> 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=us-ascii Content-Disposition: inline In-Reply-To: <20240604121551.07192993@gandalf.local.home> On Tue, Jun 04, 2024 at 12:15:51PM -0400, Steven Rostedt wrote: > On Tue, 04 Jun 2024 12:13:15 +0200 > Paolo Abeni wrote: > > > On Thu, 2024-05-30 at 20:16 +0000, Mina Almasry wrote: > > > diff --git a/net/core/devmem.c b/net/core/devmem.c > > > index d82f92d7cf9ce..d5fac8edf621d 100644 > > > --- a/net/core/devmem.c > > > +++ b/net/core/devmem.c > > > @@ -32,6 +32,14 @@ static void net_devmem_dmabuf_free_chunk_owner(struct gen_pool *genpool, > > > kfree(owner); > > > } > > > > > > +static inline dma_addr_t net_devmem_get_dma_addr(const struct net_iov *niov) > > > > Minor nit: please no 'inline' keyword in c files. > > I'm curious. Is this a networking rule? I use 'inline' in my C code all the > time. It mostly comes from Documentation/process/coding-style.rst: 15) The inline disease ---------------------- There appears to be a common misperception that gcc has a magic "make me faster" speedup option called ``inline``. While the use of inlines can be appropriate (for example as a means of replacing macros, see Chapter 12), it very often is not. Abundant use of the inline keyword leads to a much bigger kernel, which in turn slows the system as a whole down, due to a bigger icache footprint for the CPU and simply because there is less memory available for the pagecache. Just think about it; a pagecache miss causes a disk seek, which easily takes 5 milliseconds. There are a LOT of cpu cycles that can go into these 5 milliseconds. A reasonable rule of thumb is to not put inline at functions that have more than 3 lines of code in them. An exception to this rule are the cases where a parameter is known to be a compiletime constant, and as a result of this constantness you *know* the compiler will be able to optimize most of your function away at compile time. For a good example of this later case, see the kmalloc() inline function. Often people argue that adding inline to functions that are static and used only once is always a win since there is no space tradeoff. While this is technically correct, gcc is capable of inlining these automatically without help, and the maintenance issue of removing the inline when a second user appears outweighs the potential value of the hint that tells gcc to do something it would have done anyway. Jason