From: Ingo Molnar <mingo@elte.hu>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Andrew Morton <akpm@osdl.org>,
linux-kernel@vger.kernel.org, arjan@infradead.org
Subject: Re: [patch] uninline init_waitqueue_*() functions
Date: Thu, 6 Jul 2006 00:30:42 +0200 [thread overview]
Message-ID: <20060705223042.GA519@elte.hu> (raw)
In-Reply-To: <Pine.LNX.4.64.0607051458200.12404@g5.osdl.org>
* Linus Torvalds <torvalds@osdl.org> wrote:
> On Wed, 5 Jul 2006, Ingo Molnar wrote:
> >
> > yeah, i'd not want to skip over some interesting and still unexplained
> > effect either, but 35 bytes isnt all that outlandish and from everything
> > i've seen it's a real win. Here is an actual example:
> >
> > c0fb6137: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
> > c0fb613e: 00
> > c0fb613f: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
> > c0fb6146: 00
> > c0fb6147: c7 43 60 00 00 00 00 movl $0x0,0x60(%ebx)
> > c0fb614e: 8b 44 24 08 mov 0x8(%esp),%eax
> > c0fb6152: 89 43 5c mov %eax,0x5c(%ebx)
> > c0fb6155: 8d 43 64 lea 0x64(%ebx),%eax
> > c0fb6158: 89 40 04 mov %eax,0x4(%eax)
> > c0fb615b: 89 43 64 mov %eax,0x64(%ebx)
>
> Ahh, it's _that_ old gcc problem.
>
> That's actually a different thing.
>
> Gcc is HORRIBLY BAD at doing the simple
>
> some_structure = (struct somestruct) { INITIAL };
>
> assignments. It is so ludicrously bad that it's sad. It tends to do
> that as a local "struct somestruct" on the stack that gets
> initialized, followed by a memcpy().
>
> In this case, the problem appears to be the spinlock initialization
> code.
>
> In other words, I suspect 90% of your improvement was because you got
> that braindamage out of line.
>
> It would be _much_ better to just fix "spin_lock_init()" instead. That
> would help a lot of _other_ users too, not just the waitqueue
> initializations.
>
> Making that a real function (and inline only for the non-debug case,
> at which point it's just a simple and small store) would be much
> better.
in the debug case it's already a function. (by virtue of lockdep) But
what happens here is CONFIG_PREEMPT and break_lock and thus we get two
fields which get initialized in that stupid way. I'll try a better
initialization sequence. This was with gcc 4.0.1.
Ingo
next prev parent reply other threads:[~2006-07-05 22:35 UTC|newest]
Thread overview: 134+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-05 8:49 [patch] uninline init_waitqueue_*() functions Ingo Molnar
2006-07-05 9:31 ` Andrew Morton
2006-07-05 9:32 ` Ingo Molnar
2006-07-05 9:53 ` Andrew Morton
2006-07-05 10:26 ` Ingo Molnar
2006-07-05 11:30 ` Ingo Molnar
2006-07-05 11:46 ` Ingo Molnar
2006-07-05 17:10 ` Andrew Morton
2006-07-05 19:35 ` Ingo Molnar
2006-07-05 20:18 ` Andrew Morton
2006-07-05 20:36 ` Linus Torvalds
2006-07-05 20:47 ` Ingo Molnar
2006-07-05 21:15 ` Ingo Molnar
2006-07-05 21:21 ` Linus Torvalds
2006-07-05 21:45 ` Ingo Molnar
2006-07-05 21:58 ` Randy.Dunlap
2006-07-05 22:00 ` Ingo Molnar
2006-07-05 22:10 ` Randy.Dunlap
2006-07-05 22:27 ` Ingo Molnar
2006-07-05 23:15 ` Adrian Bunk
2006-07-05 22:09 ` Linus Torvalds
2006-07-05 22:30 ` Ingo Molnar [this message]
2006-07-05 23:11 ` Linus Torvalds
2006-07-06 8:16 ` [patch] spinlocks: remove 'volatile' Ingo Molnar
2006-07-06 8:23 ` Ingo Molnar
2006-07-06 9:27 ` Heiko Carstens
2006-07-06 9:34 ` Arjan van de Ven
2006-07-06 11:59 ` linux-os (Dick Johnson)
2006-07-06 12:01 ` Arjan van de Ven
2006-07-06 12:29 ` linux-os (Dick Johnson)
2006-07-06 12:39 ` Arjan van de Ven
2006-07-06 13:39 ` J.A. Magallón
2006-07-06 13:43 ` Arjan van de Ven
2006-07-06 14:05 ` Chase Venters
2006-07-06 14:26 ` Andreas Schwab
2006-07-06 16:40 ` Nick Piggin
2006-07-06 23:19 ` David Schwartz
2006-07-06 18:15 ` Mark Lord
2006-07-06 19:15 ` Linus Torvalds
2006-07-06 19:33 ` Chris Friesen
2006-07-06 19:37 ` Mark Lord
2006-07-06 20:28 ` Chris Friesen
2006-07-06 20:32 ` Linus Torvalds
2006-07-06 19:38 ` Arjan van de Ven
2006-07-06 19:41 ` Måns Rullgård
2006-07-06 19:42 ` Jeff Garzik
2006-07-06 19:58 ` Linus Torvalds
2006-07-06 20:27 ` Mark Lord
2006-07-06 20:40 ` Chris Friesen
2006-07-06 21:00 ` Linus Torvalds
2006-07-08 8:40 ` Avi Kivity
2006-07-08 8:51 ` Arjan van de Ven
2006-07-08 9:20 ` Avi Kivity
2006-07-08 9:51 ` Arjan van de Ven
2006-07-08 10:18 ` Avi Kivity
2006-07-08 10:28 ` Thomas Gleixner
2006-07-09 4:19 ` Benjamin Herrenschmidt
2006-07-09 12:47 ` Avi Kivity
2006-07-09 19:16 ` David Schwartz
2006-07-09 19:51 ` Theodore Tso
2006-07-09 20:40 ` [OT] 'volatile' in userspace Rutger Nijlunsing
2006-07-10 3:42 ` Theodore Tso
2006-07-10 17:00 ` Joshua Hudson
2006-07-10 17:54 ` Nick Piggin
2006-07-11 7:48 ` Jan Engelhardt
2006-07-11 11:53 ` Nick Piggin
2006-07-11 19:09 ` Björn Steinbrink
2006-07-11 20:55 ` Jeff Dike
2006-07-10 18:54 ` Jeff Dike
2006-07-10 20:09 ` Philippe Troin
2006-07-10 20:52 ` Jeff Dike
2006-07-06 16:07 ` [patch] spinlocks: remove 'volatile' Linus Torvalds
2006-07-06 16:13 ` Linus Torvalds
2006-07-06 17:04 ` Jeff Garzik
2006-07-06 17:52 ` linux-os (Dick Johnson)
2006-07-06 18:00 ` Linus Torvalds
2006-07-06 21:02 ` J.A. Magallón
2006-07-06 21:12 ` Linus Torvalds
2006-07-06 18:10 ` Michael Buesch
2006-07-06 18:16 ` Chase Venters
2006-07-07 18:16 ` Krzysztof Halasa
2006-07-07 19:51 ` linux-os (Dick Johnson)
2006-07-07 20:25 ` Linus Torvalds
2006-07-07 21:22 ` linux-os (Dick Johnson)
2006-07-07 21:48 ` Chase Venters
2006-07-08 10:00 ` Krzysztof Halasa
2006-07-08 13:41 ` Chase Venters
2006-07-08 20:09 ` Krzysztof Halasa
2006-07-08 20:40 ` Chase Venters
2006-07-08 20:47 ` Chase Venters
2006-07-09 10:57 ` Krzysztof Halasa
2006-07-07 21:59 ` Linus Torvalds
2006-07-07 22:06 ` Linus Torvalds
2006-07-08 20:49 ` Pavel Machek
2006-07-08 21:43 ` Linus Torvalds
2006-07-07 22:05 ` J.A. Magallón
2006-07-07 22:22 ` Chase Venters
2006-07-07 22:37 ` J.A. Magallón
2006-07-08 9:33 ` David Schwartz
2006-07-07 22:49 ` J.A. Magallón
2006-07-07 22:59 ` Vadim Lobanov
2006-07-07 23:18 ` Chase Venters
2006-07-07 23:36 ` Davide Libenzi
2006-07-07 22:09 ` Ingo Molnar
2006-07-08 7:36 ` Ingo Molnar
2006-07-07 20:39 ` Krzysztof Halasa
2006-07-07 23:06 ` Björn Steinbrink
2006-07-08 8:36 ` Avi Kivity
2006-07-06 19:32 ` Jan Engelhardt
2006-07-06 20:26 ` Jeremy Fitzhardinge
2006-07-06 20:55 ` Jan Engelhardt
2006-07-06 21:07 ` Linus Torvalds
2006-07-06 19:56 ` Linus Torvalds
2006-07-06 20:34 ` Linus Torvalds
2006-07-08 22:50 ` Ralf Baechle
2006-07-09 3:09 ` Linus Torvalds
2006-07-09 3:07 ` Keith Owens
2006-07-09 3:29 ` Linus Torvalds
2006-07-09 3:43 ` Keith Owens
2006-07-09 3:58 ` Linus Torvalds
2006-07-09 6:13 ` David Miller
2006-07-09 14:28 ` Roman Zippel
2006-07-09 15:27 ` Linus Torvalds
2006-07-06 8:18 ` [patch] lockdep: clean up completion initializer in smpboot.c Ingo Molnar
2006-07-06 8:23 ` [patch] uninline init_waitqueue_*() functions Ingo Molnar
2006-07-06 9:02 ` Andrew Morton
2006-07-06 9:12 ` [patch] uninline init_waitqueue_head() Ingo Molnar
2006-07-05 20:45 ` [patch] uninline init_waitqueue_*() functions Ingo Molnar
2006-07-05 10:37 ` Christoph Hellwig
2006-07-05 10:44 ` Andrew Morton
2006-07-05 10:46 ` Andrew Morton
2006-07-05 10:47 ` Ingo Molnar
2006-07-05 9:54 ` [patch] uninline init_waitqueue_*() functions, fix Ingo Molnar
-- strict thread matches above, loose matches on Subject: below --
2006-07-05 17:12 [patch] uninline init_waitqueue_*() functions Chuck Ebbert
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=20060705223042.GA519@elte.hu \
--to=mingo@elte.hu \
--cc=akpm@osdl.org \
--cc=arjan@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.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