From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 D9E501D0DEE; Mon, 2 Mar 2026 07:19:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772435943; cv=none; b=FSpihM9W3L0zhZNpk4UicboUqYGQJzQm2hMR8ENjmw16t1hdo/wq28OmSzCcm6CbEjgNzYrLm+UGS8BvyjnKYsnsgptVefU1ZrHMaLCn/KVU4mmj5Ag9qWJRKQ9xowjR6Xx5yX6xe9ziLN0JJ3XFsppdj2+d1eQ/HAgJi44uTl4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772435943; c=relaxed/simple; bh=IWFUYHylqRFZaRm5r8RrLRDa3YLgSmjWVVLiN7LHGy4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=k5b/g0CzCTvCFTaHqUrg3lyz6k0fGNA3sK3tLcVfj7t3oXVdAg1MWxOlk91xsC4Cl6sX7fr/GHhnA0beONPhLYzs5PTieyRkvJueYTHR3hjYqZYpJ5Ui5OwtijYoaqGfoo0bFxHgeYG80WLRjes2Bnhnz4cxInFFy+lv4TSxxGw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=l9ZaeF4a; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="l9ZaeF4a" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42D3EC19423; Mon, 2 Mar 2026 07:18:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772435943; bh=IWFUYHylqRFZaRm5r8RrLRDa3YLgSmjWVVLiN7LHGy4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=l9ZaeF4aPU2R5rFFz1KzYT2AzZwYDAcXSFOWGleyGX4IJCSYh3ey9X9MFaec25Jvt R41n5ogriJLHLbTnbAhRUlTENuE8zHqJZ4hmXfIoI14lQa1CZ833Zh2NufwlrmebRa uRquDMiQ7euErjNofmy94n80bTQAgtr9fYExYWtiCa7u6OSqVRwgJZtiI9fbt0Id5d X42If6KFdaneLbuS8GYtRtOBZ+FwIRmVTq7yyXCkl7+v+oM/ByWo3UXqtNZIjzLubr CxI1q1dwT1MHjvxnZsz6xERpo7UqyUz5qw5zjzCMpgHhrhI/5JG2NlqgMLZulaFmBF wrN8cEwrndjoQ== From: Andreas Hindborg To: Gary Guo , Benno Lossin , Gary Guo , Miguel Ojeda , =?utf-8?Q?Bj=C3=B6rn?= Roy Baron , Alice Ryhl , Trevor Gross , Danilo Krummrich , Greg Kroah-Hartman , Dave Ertman , Ira Weiny , Leon Romanovsky , Paul Moore , Serge Hallyn , "Rafael J. Wysocki" , David Airlie , Simona Vetter , Alexander Viro , Christian Brauner , Jan Kara , Igor Korotin , Daniel Almeida , Lorenzo Stoakes , "Liam R. Howlett" , Viresh Kumar , Nishanth Menon , Stephen Boyd , Bjorn Helgaas , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Boqun Feng , Vlastimil Babka , Uladzislau Rezki Cc: linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-block@vger.kernel.org, linux-security-module@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-pm@vger.kernel.org, linux-pci@vger.kernel.org Subject: Re: [PATCH v16 01/10] rust: alloc: add `KBox::into_nonnull` In-Reply-To: References: <20260224-unique-ref-v16-0-c21afcb118d3@kernel.org> <20260224-unique-ref-v16-1-c21afcb118d3@kernel.org> <87ldgbbjal.fsf@t14s.mail-host-address-is-not-set> Date: Mon, 02 Mar 2026 08:18:47 +0100 Message-ID: <87ikbebsx4.fsf@t14s.mail-host-address-is-not-set> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain "Gary Guo" writes: > On Sun Mar 1, 2026 at 7:59 PM GMT, Benno Lossin wrote: >> On Sun Mar 1, 2026 at 8:25 PM CET, Gary Guo wrote: >>> `#[inline]` is a hint to make it more likely for compilers to inline. Without >>> them, you're relying on compiler heurstics only. There're cases (especially with >>> abstractions) where the function may look complex as it contains lots of >>> function calls (so compiler heurstics avoid inlining them), but they're all >>> zero-cost abstractions so eventually things get optimized away. >>> >>> For non-generic functions, there is additional issue where only very small >>> functions get automatically inlined, otherwise a single copy is generated at the >>> defining crate and compiler run on a dependant crate has no chance to even peek >>> what's in the function. >>> >>> If you know a function should be inlined, it's better to just mark them as such, >>> so there're no surprises. >> >> Should we set clippy::missing_inline_in_public_items [1] to "warn"? >> >> [1]: https://rust-lang.github.io/rust-clippy/master/index.html?search=missing_inline_in_public_items > > That requires *all* public items to be `#[inline]` regardless the size, which is > excessive. I was thinking something similar, in clippy or checkpatch.pl. If we should always have this attribute for small functions, we need to have a check. Best regards, Andreas Hindborg