Rust for Linux List
 help / color / mirror / Atom feed
From: "Alexandre Courbot" <acourbot@nvidia.com>
To: "Gary Guo" <gary@kernel.org>
Cc: "Gary Guo" <gary@garyguo.net>,
	"Yury Norov" <yury.norov@gmail.com>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Boqun Feng" <boqun@kernel.org>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rust: bitfield: mark `Debug` impl as `#[inline]`
Date: Sat, 13 Jun 2026 14:43:27 +0900	[thread overview]
Message-ID: <DJ7OKONXCQPN.1N5F9PJSNNGIR@nvidia.com> (raw)
In-Reply-To: <DJ6SM9BJ7GHN.JX9HXO3ZMBPM@nvidia.com>

On Fri Jun 12, 2026 at 1:40 PM JST, Alexandre Courbot wrote:
> On Fri Jun 12, 2026 at 4:05 AM JST, Gary Guo wrote:
>> From: Gary Guo <gary@garyguo.net>
>>
>> A `Debug` impl is for debugging and is normally not used, and therefore
>> should ideally not be code-generated unless used. However, Rust has no way
>> of knowing if a dependent crate is going to use the trait impl or not, so
>> unless it is marked as `#[inline]`, it will be code-generated in the
>> defining crate (as it is not generic).
>>
>> Mark the impl generated by bitfield macro `#[inline]`, so they do not stay
>> in the binary unless used.
>>
>> This reduces nova-core.o .text by 17% (from 151922 bytes to 125676 bytes).
>>
>> Signed-off-by: Gary Guo <gary@garyguo.net>
>
> Ouch, well-spotted. Thanks for this.
>
> Acked-by: Alexandre Courbot <acourbot@nvidia.com>

Btw, should this be

Fixes: b7b8b4ccdad4 ("rust: extract `bitfield!` macro from `register!`")

?

  reply	other threads:[~2026-06-13  5:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-11 19:05 [PATCH] rust: bitfield: mark `Debug` impl as `#[inline]` Gary Guo
2026-06-11 23:01 ` Alice Ryhl
2026-06-12  4:40 ` Alexandre Courbot
2026-06-13  5:43   ` Alexandre Courbot [this message]
2026-06-13  8:25     ` Miguel Ojeda
2026-06-13  8:24 ` Miguel Ojeda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DJ7OKONXCQPN.1N5F9PJSNNGIR@nvidia.com \
    --to=acourbot@nvidia.com \
    --cc=a.hindborg@kernel.org \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=dakr@kernel.org \
    --cc=gary@garyguo.net \
    --cc=gary@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tmgross@umich.edu \
    --cc=yury.norov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox