[lkml]   [2004]   [Oct]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: Semaphore assembly-code bug
    On Fri, Oct 29, 2004 at 07:46:06AM -0700, Linus Torvalds wrote:
    > On Fri, 29 Oct 2004, linux-os wrote:
    > >
    > > Linus, please check this out.
    > Yes, I concur. However, I'd suggest changing the "addl $4,%esp" into a
    > "popl %ecx", which is smaller and apparently faster on some CPU's (ecx
    > obviously gets immediately overwritten by the next popl).

    Rather popl %eax or popl %edx then, a basic and MMX Pentium
    cannot pair:

    popl %ecx
    popl %ecx

    for the simple reason that two instructions that have the
    same destination register can't be paired.

    OTOH, the other argument about reading or not memory in
    this thread are a red herring. An additional memory read
    is cheap for data that is guaranteed to be in a cache line
    used by adjacent (in time) instructions.

    Otherwise regparm(1) might even be better, movl %ecx,%eax is
    the same size as push+pop, is faster, and may even reduce
    stack usage by 4 bytes.

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2005-03-22 14:07    [W:0.020 / U:4.872 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site