public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kent Overstreet <kent.overstreet@linux.dev>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>,
	Waiman Long <longman@redhat.com>,
	Boqun Feng <boqun.feng@gmail.com>,
	Brian Foster <bfoster@redhat.com>,
	Dave Chinner <dchinner@redhat.com>
Subject: Re: [PATCH v2] locking: SIX locks (shared/intent/exclusive)
Date: Mon, 22 May 2023 17:52:16 -0400	[thread overview]
Message-ID: <ZGvkEFjNJSQHopAT@moria.home.lan> (raw)
In-Reply-To: <CAHk-=wgxN65O-F3R5detmma2MDjDRn4S_qkeKVCCp95c5+gYmA@mail.gmail.com>

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@linux.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...

  reply	other threads:[~2023-05-22 21:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-22 17:13 [PATCH v2] locking: SIX locks (shared/intent/exclusive) Kent Overstreet
2023-05-22 18:58 ` Linus Torvalds
2023-05-22 20:13   ` Kent Overstreet
2023-05-22 20:53     ` Linus Torvalds
2023-05-22 21:52       ` Kent Overstreet [this message]
2023-05-22 22:05 ` Boqun Feng
2023-05-23  4:19   ` Kent Overstreet

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=ZGvkEFjNJSQHopAT@moria.home.lan \
    --to=kent.overstreet@linux.dev \
    --cc=bfoster@redhat.com \
    --cc=boqun.feng@gmail.com \
    --cc=dchinner@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=torvalds@linux-foundation.org \
    --cc=will@kernel.org \
    /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