lkml.org 
[lkml]   [2006]   [Jul]   [8]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
    /
    DateSat, 8 Jul 2006 23:50:10 +0100
    FromRalf Baechle <>
    SubjectRe: [patch] spinlocks: remove 'volatile'
    On Thu, Jul 06, 2006 at 01:34:14PM -0700, Linus Torvalds wrote:
    
    > On Thu, 6 Jul 2006, Linus Torvalds wrote:
    > > 
    > > So I _think_ that we should change the "=m" to the much more correct "+m" 
    > > at the same time (or before - it's really a bug-fix regardless) as 
    > > removing the "volatile".
    > 
    > Here's a first cut (UNTESTED!) for x86. I didn't check any other 
    > architectures, I bet they have similar problems.
    
    I tried the same on MIPS, for lazyness sake at first only in atomic.h.  With
    gcc 3.3 the code size is exactly the same with both "=m" and "+m", so I
    didn't look into details of the generated code.  With gcc 4.1 "+m" results
    in a size increase of about 1K for the ip27_defconfig kernel.  For example:
    
    <unlock_kernel>:
           df830000        ld      v1,0(gp)
           8c620028        lw      v0,40(v1)
           04400014        bltz    v0,a80000000029944c <unlock_kernel+0x5c>
           00000000        nop
           2442ffff        subiu   v0,v0,1
           ac620028        sw      v0,40(v1)	# current->lock_depth
           8c630028        lw      v1,40(v1)	# current->lock_depth
           0461000b        bgez    v1,a80000000029943c <unlock_kernel+0x4c>
    The poinless load isn't generated with "=m".  The interesting thing is
    that in all the instances of bloat I looked at it was actually happening
    not as part of the asm statement itself, so maybe gcc's reload is getting
    a little confused.
    
      Ralf
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at  http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at  http://www.tux.org/lkml/
    
    
    \
     
     \ /
      Last update: 2006-07-09 00:53    [from the cache]
    ©2003-2008