[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YqkLRSBaeb6U1ngW@hirez.programming.kicks-ass.net>
Date: Wed, 15 Jun 2022 00:27:17 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Nick Desaulniers <ndesaulniers@...gle.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Alexander Potapenko <glider@...gle.com>,
Evgenii Stepanov <eugenis@...gle.com>,
Kees Cook <keescook@...omium.org>,
Marco Elver <elver@...gle.com>,
Nathan Chancellor <nathan@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Vitaly Buka <vitalybuka@...gle.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-toolchains <linux-toolchains@...r.kernel.org>
Subject: Re: [PATCH] [RFC] Initialization of unused function parameters
On Tue, Jun 14, 2022 at 11:08:33AM -0700, Nick Desaulniers wrote:
> One thing I'm curious about; if you have an aggregate in C (struct or
> array) and don't fully initialize the whole object, just
> members/sub-objects, but only use those I assume that's not UB? (Which
> is what my maybe_init example does). I think that's fine.
Perf does something like that. We only explicitly initialize the first
cacheline of a structure because that's *always* used. Any other field
will only be initialized on request.
At the time (and i've not benchmarked this in a good few years) that was
a significant performance win.
Powered by blists - more mailing lists