linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Denis Vlasenko <vda@port.imtp.ilyichevsk.odessa.ua>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Andi Kleen <ak@suse.de>, linux-kernel@vger.kernel.org
Subject: Re: Semaphore assembly-code bug
Date: Sun, 31 Oct 2004 00:00:38 +0300	[thread overview]
Message-ID: <200410310000.38019.vda@port.imtp.ilyichevsk.odessa.ua> (raw)
In-Reply-To: <Pine.LNX.4.58.0410301040050.28839@ppc970.osdl.org>

On Saturday 30 October 2004 20:53, Linus Torvalds wrote:
> > > > 	movl 4(%esp),%ecx
> > > > 	movl 8(%esp),%edx
> > > > 	movl 12(%esp),%eax
> > > > 	addl $16,%esp
> > > > 
> > > > which is also one of the biggest alternatives.
> > > 
> > > For K8 it should be the fastest way. K7 probably too.
> > 
> > Pity. I always loved 1 byte insns :)
> 
> I personally am a _huge_ believer in small code. 

Thankfully you are not alone - a horde of uclibc/dietlibc/busybox
users shares these views. Also see http://smarden.org/pape/

> The sequence
> 
> 	popl %eax
> 	popl %ecx
> 	popl %edx
> 	popl %eax
> 
> is four bytes. In contrast, the three moves and an add is 15 bytes. That's 
> almost 4 times as big.
> 
> And size _does_ matter. The extra 11 bytes means that if you have six of
> these sequences in your program, you are pretty much _guaranteed_ one more
> icache miss from memory. That's a few hundred cycles these days.  
> Considering that you _maybe_ won a cycle or two each time it was executed,
> it's not at all clear that it's a win, except in benchmarks that have huge
> repeat-rates. Real life doesn't usually have that. In many real-life
> schenarios, repeat rates are in the tens of hundreds for most code...

If only glibc / X / KDE / OpenOffice (ugggh) people could hear you more...

  PID USER     PRI  NI  SIZE  RSS SHARE STAT %CPU %MEM   TIME CPU COMMAND
15364 root      15   0 38008  26M 28496 S     0,0 10,8   0:57   0 kmail
20022 root      16   0 40760  24M 23920 S     0,1 10,0   0:04   0 mozilla-bin
 1627 root      14  -1 71064  19M 53192 S <   0,1  7,9   3:16   0 X
 1700 root      15   0 25348  16M 23508 S     0,1  6,5   0:46   0 kdeinit
 3578 root      15   0 24032  14M 21524 S     0,5  5,8   0:23   0 konsole
--
vda


  reply	other threads:[~2004-10-30 21:01 UTC|newest]

Thread overview: 99+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Pine.LNX.4.58.0410181540080.2287@ppc970.osdl.org.suse.lists.linux.kernel>
     [not found] ` <417550FB.8020404@drdos.com.suse.lists.linux.kernel>
     [not found]   ` <1098218286.8675.82.camel@mentorng.gurulabs.com.suse.lists.linux.kernel>
     [not found]     ` <41757478.4090402@drdos.com.suse.lists.linux.kernel>
     [not found]       ` <20041020034524.GD10638@michonline.com.suse.lists.linux.kernel>
     [not found]         ` <1098245904.23628.84.camel@krustophenia.net.suse.lists.linux.kernel>
     [not found]           ` <1098247307.23628.91.camel@krustophenia.net.suse.lists.linux.kernel>
     [not found]             ` <Pine.LNX.4.61.0410200744310.10521@chaos.analogic.com.suse.lists.linux.kernel>
     [not found]               ` <Pine.LNX.4.61.0410290805570.11823@chaos.analogic.com.suse.lists.linux.kernel>
     [not found]                 ` <Pine.LNX.4.58.0410290740120.28839@ppc970.osdl.org.suse.lists.linux.kernel>
     [not found]                   ` <41826A7E.6020801@domdv.de.suse.lists.linux.kernel>
     [not found]                     ` <Pine.LNX.4.61.0410291255400.17270@chaos.analogic.com.suse.lists.linux.kernel>
     [not found]                       ` <Pine.LNX.4.58.0410291103000.28839@ppc970.osdl.org.suse.lists.linux.kernel>
     [not found]                         ` <Pine.LNX.4.61.0410291631250.8616@twinlark.arctic.org.suse.lists.linux.kernel>
2004-10-30  2:04                           ` Semaphore assembly-code bug Andi Kleen
     [not found]                   ` <Pine.LNX.4.61.0410291316470.3945@chaos.analogic.com.suse.lists.linux.kernel>
     [not found]                     ` <20041029175527.GB25764@redhat.com.suse.lists.linux.kernel>
     [not found]                       ` <Pine.LNX.4.61.0410291416040.4844@chaos.analogic.com.suse.lists.linux.kernel>
     [not found]                         ` <Pine.LNX.4.58.0410291133220.28839@ppc970.osdl.org.suse.lists.linux.kernel>
2004-10-30  2:13                           ` Andi Kleen
2004-10-30  9:28                             ` Denis Vlasenko
2004-10-30 17:53                               ` Linus Torvalds
2004-10-30 21:00                                 ` Denis Vlasenko [this message]
2004-10-30 21:14                                   ` code bloat [was Re: Semaphore assembly-code bug] Lee Revell
2004-10-30 22:11                                     ` Denis Vlasenko
2004-10-30 22:25                                       ` Lee Revell
2004-10-31 14:06                                         ` Diego Calleja
2004-10-31 20:53                                           ` Z Smith
2004-10-31 23:35                                             ` Rogério Brito
2004-11-01  1:20                                               ` Z Smith
2004-11-01 14:48                                             ` Diego Calleja
2004-11-01 15:09                                               ` [OT] " Russell Miller
2004-10-30 22:27                                       ` Tim Hockin
2004-10-30 22:44                                         ` Jeff Garzik
2004-10-30 22:50                                           ` Tim Hockin
2004-10-31 20:15                                           ` Theodore Ts'o
2004-10-31 20:21                                             ` Jeff Garzik
2004-10-31 21:06                                             ` Jan Engelhardt
2004-11-01 11:27                                             ` Alan Cox
2004-11-01 13:40                                               ` Denis Vlasenko
2004-11-01 23:04                                                 ` Alan Cox
2004-10-30 23:13                                         ` Denis Vlasenko
2004-10-30 22:45                                           ` Alan Cox
2004-10-31  1:21                                             ` Z Smith
2004-10-31  2:47                                               ` Jim Nelson
2004-10-31 15:19                                               ` Alan Cox
2004-10-31 20:18                                                 ` Z Smith
2004-11-01 11:05                                                   ` Alan Cox
2004-10-30 23:20                                           ` [OT] " Lee Revell
2004-10-30 22:52                                             ` Alan Cox
2004-10-31  1:09                                               ` Ken Moffat
2004-10-31  2:42                                                 ` Tim Connors
2004-10-31  4:45                                                   ` Paul
2004-10-31 14:44                                                 ` Alan Cox
2004-10-31  0:48                                             ` Andi Kleen
2004-10-30 23:28                                           ` Tim Hockin
2004-10-31  2:04                                             ` Michael Clark
2004-10-31  6:49                                         ` Jan Engelhardt
2004-10-31 21:09                                           ` Z Smith
2004-10-31 21:13                                             ` Jan Engelhardt
2004-10-31 21:48                                               ` Z Smith
2004-11-01 11:29                                               ` Alan Cox
2004-11-01 12:36                                                 ` Jan Engelhardt
2004-11-01 15:17                                           ` Lee Revell
2004-11-01 16:56                                             ` Kristian Høgsberg
2004-10-31  6:37                                     ` Jan Engelhardt
2004-10-31  0:39                                 ` Semaphore assembly-code bug Andi Kleen
2004-10-31  1:43                                   ` Linus Torvalds
2004-10-31  2:04                                     ` Andi Kleen
2004-10-18 22:45 Linux v2.6.9 Linus Torvalds
2004-10-19 17:38 ` Linux v2.6.9 and GPL Buyout Jeff V. Merkey
2004-10-19 20:38   ` Dax Kelson
2004-10-19 20:09     ` Jeff V. Merkey
2004-10-20  3:45       ` Ryan Anderson
2004-10-20  4:18         ` Lee Revell
2004-10-20  4:41           ` Lee Revell
2004-10-20 11:49             ` Richard B. Johnson
2004-10-29 12:12               ` Semaphore assembly-code bug linux-os
2004-10-29 14:46                 ` Linus Torvalds
2004-10-29 15:11                   ` Andi Kleen
2004-10-29 18:18                     ` Linus Torvalds
2004-10-29 18:35                       ` Richard Henderson
2004-10-29 16:06                   ` Andreas Steinmetz
2004-10-29 17:08                     ` linux-os
2004-10-29 18:06                       ` Linus Torvalds
2004-10-29 18:39                         ` linux-os
2004-10-29 19:12                           ` Linus Torvalds
2004-11-01  1:31                             ` linux-os
2004-11-01  5:49                               ` Linus Torvalds
2004-11-01 20:23                               ` dean gaudet
2004-11-01 20:52                                 ` linux-os
2004-11-01 21:23                                   ` dean gaudet
2004-11-01 22:22                                     ` linux-os
2004-11-01 21:40                                   ` Linus Torvalds
2004-11-01 21:46                                     ` Linus Torvalds
2004-11-02 15:02                                       ` linux-os
2004-11-02 16:02                                         ` Linus Torvalds
2004-11-02 16:06                                           ` Linus Torvalds
2004-11-02 16:51                                             ` linux-os
2004-11-01 22:16                                     ` linux-os
2004-11-01 22:26                                       ` Linus Torvalds
2004-11-01 23:14                                         ` linux-os
2004-11-01 23:42                                           ` Linus Torvalds
2004-11-03  1:52                                       ` Horst von Brand
2004-11-03 21:24                                       ` Bill Davidsen
2004-11-02  6:37                                     ` Chris Friesen
2004-10-29 18:58                         ` Andreas Steinmetz
2004-10-29 19:15                           ` Linus Torvalds
2004-10-29 19:40                             ` Andreas Steinmetz
2004-10-29 19:56                               ` Linus Torvalds
2004-10-29 22:07                                 ` Jeff Garzik
2004-10-29 23:50                               ` dean gaudet
2004-10-30  0:15                                 ` Linus Torvalds
2004-10-29 23:37                         ` dean gaudet
2004-10-29 17:22                   ` linux-os
2004-10-29 17:55                     ` Richard Henderson
2004-10-29 18:17                       ` linux-os
2004-10-29 18:42                         ` Linus Torvalds
2004-10-29 18:54                           ` Linus Torvalds
2004-10-30  3:35                           ` Jeff Garzik
2004-10-29 19:20                     ` Linus Torvalds
2004-10-29 19:26                       ` Linus Torvalds
2004-10-29 21:03                       ` Linus Torvalds
2004-10-29 17:57                   ` Richard Henderson
2004-10-29 18:37                   ` Gabriel Paubert

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=200410310000.38019.vda@port.imtp.ilyichevsk.odessa.ua \
    --to=vda@port.imtp.ilyichevsk.odessa.ua \
    --cc=ak@suse.de \
    --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;
as well as URLs for NNTP newsgroup(s).