lkml.org 
[lkml]   [2011]   [Jan]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 0/6] Clean up ticketlock implementation
From
On Tue, Jan 25, 2011 at 10:41 AM, Jeremy Fitzhardinge <jeremy@goop.org> wrote:
> From: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
>
> Hi all,
>
> This series cleans up the x86 ticketlock implementation by converting
> a large proportion of it to C.  This eliminates the need for having
> separate implementations for "large" (NR_CPUS >= 256) and "small"
> (NR_CPUS < 256) ticket locks.
>
> This also lays the groundwork for future changes to the ticketlock
> implementation.
>
> Of course, the big question when converting from assembler to C is
> what the compiler will do to the code.  In general, the results are
> very similar.
>
> For example, the original hand-coded small-ticket ticket_lock is:
>      movl   $256, %eax
>      lock xadd %ax,(%rdi)
>   1: cmp    %ah,%al
>      je     2f
>      pause
>      mov    (%rdi),%al
>      jmp    1b
>   2:
>
> The C version, compiled by gcc 4.5.1 is:
>        movl   $256, %eax
>        lock; xaddw %ax, (%rdi)
>        movzbl  %ah, %edx
> .L3:    cmpb    %dl, %al
>        je      .L2
>        rep; nop
>        movb    (%rdi), %al     # lock_1(D)->D.5949.tickets.head, inc$head
>        jmp     .L3     #
> .L2:
>
> So very similar, except the compiler misses directly comparing
> %ah to %al.

Oh :(

Have you filed a bug with gcc?
--
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: 2011-01-25 02:11    [W:0.136 / U:0.440 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site