[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZGvkEFjNJSQHopAT@moria.home.lan>
Date: Mon, 22 May 2023 17:52:16 -0400
From: Kent Overstreet <kent.overstreet@...ux.dev>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: linux-kernel@...r.kernel.org,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>, Will Deacon <will@...nel.org>,
Waiman Long <longman@...hat.com>,
Boqun Feng <boqun.feng@...il.com>,
Brian Foster <bfoster@...hat.com>,
Dave Chinner <dchinner@...hat.com>
Subject: Re: [PATCH v2] locking: SIX locks (shared/intent/exclusive)
On Mon, May 22, 2023 at 01:53:36PM -0700, Linus Torvalds wrote:
> On Mon, May 22, 2023 at 1:13 PM Kent Overstreet
> <kent.overstreet@...ux.dev> wrote:
> >
> > Uh, I think you're wrong on this one - structs with designated
> > initializers have unspecified fields initialized to 0
>
> That's definitely true for unspecified fields.
>
> But there *are* no fields. Only padding.
>
> That said, gcc does seem to always initialize the whole thing. We even
> rely on it when it comes to structures, but I'm not sure it's strictly
> standardized - and I'm particularly not sure about unions.
>
> But there are counter-examples, like this:
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104607
>
> so maybe even structures aren't always initialized fully?
Yeah, I have to concede - if we can't rely on struct padding being
initialized we can't rely on union padding either.
> No, Because of *alignment* issues.
>
> An u32 is 4-byte aligned. But "set_bit()" requires "long" alignmnent,.
Ah - right...
Powered by blists - more mailing lists