From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (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 5880A3587A9 for ; Mon, 19 Jan 2026 10:50:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768819823; cv=none; b=FidHKGEqlFRNdAIREQRZqHViNzMlWRY+t7VYA4HmU8gAfDdxR5dD81I6FdGwxr4vbEzDPtyco+cZdGPpH1n5hbmv8YbF9JgodvzG7/LSDNHA3eu5XjNltgpoa0GdGCnLMs4oj6qxvT1jTTFgoV8Ji55Qc26BBCq3kFAOI5FaP4Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768819823; c=relaxed/simple; bh=1OdxoGGYasc9V4+/2xWHjGW4ZBzQQu01djJnm8nwOYc=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=oQ3cSY21OJUedRq3azH4FP7BL/WeN9IAIOpTmRRj/NClNlZ+DwW03sRjoMBDYGTTWgLUvYfnsKjfmBSsTnPCChm5qwEXJGwFcgY0idwLz0AM2lZO2nRgfgE87+ShjTguOsbLElxEP/Z29I1XCkQk1WVgfgVqhF8M00fGNaUIzAM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZhIQoHO1; arc=none smtp.client-ip=209.85.221.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZhIQoHO1" Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-42fb4eeb482so2233895f8f.0 for ; Mon, 19 Jan 2026 02:50:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768819820; x=1769424620; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=EsYrqDgfDLls2j3U850tzatLT/AOiSnBFqwVPzknSNs=; b=ZhIQoHO1EOdVSYm3LjvlwSa1Ch9JlqpV/n04W2aqVHdG/xD9Ot2YL+0VP30kQ4YPeN LkDBwjtBY2fFgShgQdEXMKsqk4Ym5xIux5VOFfYRbiKgc1lGfEgkdHgXdBJAkwKdhyYv kUIu5304ROLnpj/0MWfDMAxn0mUeLpIdsUTFQZ0O1VC+uVkzZNAuwyQ5iJUx+spzmqGa gfh6DJ3G65wf4nO6FgjkQ46zB4lJ21xz93kwhYQ7Zy2teZKpsDVJOVoh3nZRkTqMYpd9 J6t3iVaVcR5mD0Ehw529c5g/oN+tFVMRilkAxAaT7OShhjmB2FvSeYdFz3B4LeJQpnu7 voxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768819820; x=1769424620; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=EsYrqDgfDLls2j3U850tzatLT/AOiSnBFqwVPzknSNs=; b=OPpGQ5HX1j7XeihnNSVOuz/7xhRD3bI9dCN1HkbG9GBYExeOEY0DHf1DibDSzZYaNO D4AYBO6wd8P7eA7gYBLa3Z0DIY0U67UmXKv9KWuNAcpOJipLzx9JADgypY7SQPDCeqfB NVeJvxsMR5HsDdWpxKVObUq5brGs1h5ITy9bOi4hGcw7HTXUPCpFnta/Do9hob0WUu87 etLY9RbwvoTS+Pa3MZqFnIQHi30fTbukHQZCqq+st0ofHL+zYahbtsObrXun9PG3rHCH 6BFXNzxOor1PbE7cgmKopLKZ5XtFjrFNPi2wRS9UAvXAjwcqhujh1igsG0XOYJf35EDc 1wyg== X-Forwarded-Encrypted: i=1; AJvYcCV40h7AU/Pv4xrTZFwFV8uXSbgENKrII3SPeU5teZgPUfVMeTk8WIx4lcIiQHv55p3mssQqh/CK/0/msAg=@vger.kernel.org X-Gm-Message-State: AOJu0YxPe5HSqoAHaBQT5xPQSlM2+7Yz86+MSnXhZogZZg8weShK7u2J ON3DM4OttmxqtnZWB6Lg1Lrs8FZGHZ+lAGtvYYakZnCH7ockf/8+pui+ X-Gm-Gg: AZuq6aJydXHbV7v6CU8ZCnA/tqCh4yEPYDqghScZh8gAvTxIGPhPBlZoKkpjU07zQMI MC89v98bQ/C56ph5dDmjjT6cua9yU8SOJM3Q95JnzXK5o7ztHs9Ov1DLhTVtNIvoXqolwrJTPth vQQzkRQtWaH6C/71V2vzoDUYcvn3hNNyhVg9rtavISvikvSpCMoYTItMrxyBlKGpyvJUEGQRjkn CxdiXw8Pi4zFtAbHJSoJzLnJBFrMrwYYD/XEJyslDPud770dV63xVxMg4NBW56Bvka6n70AZHR0 d3OAS/FJs7oO+dz0GeveYI8sOJpiS8M/xZh3s5XGATCECykedzUo4ecxF6WWOPePRgCswRrWhDI 9lreccOXsQU2SoBRYzvEWDjq6xTKXDN9HnGk8AIfPzSlCyQlUpJDcpsp4vrMwGjhhfJe5Ir+j60 OAf8REA5AtybD6PixLiRjAoAAAAxfyJTtdcagHJVtH1Go5A9ytudE0 X-Received: by 2002:a05:6000:4202:b0:432:a9fb:68f8 with SMTP id ffacd0b85a97d-4356a02643dmr11691111f8f.1.1768819819422; Mon, 19 Jan 2026 02:50:19 -0800 (PST) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43569927007sm22062014f8f.16.2026.01.19.02.50.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jan 2026 02:50:19 -0800 (PST) Date: Mon, 19 Jan 2026 10:50:17 +0000 From: David Laight To: Eric Dumazet Cc: Andrew Morton , linux-kernel , netdev@vger.kernel.org, Jakub Kicinski , Eric Dumazet , Paolo Abeni , Nicolas Pitre Subject: Re: [PATCH] compiler_types: Introduce inline_for_performance Message-ID: <20260119105017.262276b5@pumpkin> In-Reply-To: References: <20260118152448.2560414-1-edumazet@google.com> <20260118114724.cb7b7081109e88d4fa3c5836@linux-foundation.org> <20260118225802.5e658c2a@pumpkin> <20260118160125.82f645575f8327651be95070@linux-foundation.org> <20260119093339.024f8d57@pumpkin> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) 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-Transfer-Encoding: quoted-printable On Mon, 19 Jan 2026 11:25:52 +0100 Eric Dumazet wrote: > On Mon, Jan 19, 2026 at 10:33=E2=80=AFAM David Laight > wrote: > > > > On Sun, 18 Jan 2026 16:01:25 -0800 > > Andrew Morton wrote: > > =20 > > > On Sun, 18 Jan 2026 22:58:02 +0000 David Laight wrote: > > > =20 > > > > > mm/ alone has 74 __always_inlines, none are documented, I don't k= now > > > > > why they're present, many are probably wrong. > > > > > > > > > > Shit, uninlining only __get_user_pages_locked does this: > > > > > > > > > > text data bss dec hex filename > > > > > 115703 14018 64 129785 1faf9 mm/gup.o > > > > > 103866 13058 64 116988 1c8fc mm/gup.o-after =20 > > > > > > > > The next questions are does anything actually run faster (either wa= y), > > > > and should anything at all be marked 'inline' rather than 'always_i= nline'. > > > > > > > > After all, if you call a function twice (not in a loop) you may > > > > want a real function in order to avoid I-cache misses. =20 > > > > > > yup =20 > > > > I had two adjacent strlen() calls in a bit of code, the first was an > > array (in a structure) and gcc inlined the 'word at a time' code, the > > second was a pointer and it called the library function. > > That had to be sub-optimal... > > =20 > > > > But I'm sure there is a lot of code that is 'inline_for_bloat' :-) = =20 > > > > > > ooh, can we please have that? =20 > > > > Or 'inline_to_speed_up_benchmark' and the associated 'unroll this loop > > because that must make it faster'. > > =20 > > > I do think that every always_inline should be justified and commented, > > > but I haven't been energetic about asking for that. =20 > > > > Apart from the 4-line functions where it is clearly obvious. > > Especially since the compiler can still decide to not-inline them > > if they are only 'inline'. > > =20 > > > A fun little project would be go through each one, figure out whether > > > were good reasons and if not, just remove them and see if anyone > > > explains why that was incorrect. =20 > > > > It's not just always_inline, a lot of the inline are dubious. > > Probably why the networking code doesn't like it. =20 >=20 > Many __always_inline came because of clang's reluctance to inline > small things, even if the resulting code size is bigger and slower. >=20 > It is a bit unclear, this seems to happen when callers are 'big > enough'. noinstr (callers) functions are also a problem. >=20 > Let's take the list_add() call from dev_gro_receive() : clang does not > inline it, for some reason. >=20 > After adding __always_inline to list_add() and __list_add() we have > smaller and more efficient code, > for real workloads, not only benchmarks. That falls into the '4-line function' category. Where s/inline/always_inline/ makes sense. > list_add 2212 - -2212 How many copies of list_add() is that... clearly a few. Generating a real function for a 'static inline' in a header is stupid. Pretty much the intent for those is to get them inlined. I'm sure there was a suggestion to make inline mean 'always inline', except there are places where it would just be bloat. David