Re: spin_lock forgets to clobber memory and other smp fixes [was Re: [patch] waitqueue optimization, 2.4.0-test7]

From: Andrea Arcangeli (
Date: Thu Sep 07 2000 - 12:21:31 EST

On Thu, 7 Sep 2000, Jamie Lokier wrote:

>I tried it with two compilers, one older than yours and one newer:

So maybe I'm just been unlucky/lucky (depends on the point of view :) or
maybe we patched something I'm not aware of to make the kernel to compile

> .ident "GCC: (GNU) egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)"
> .ident "GCC: (GNU) 2.96 20000724 (experimental)"
>The command lines were:
> gcc -S -O2 test4.c
> kgcc -S -O2 test4.c
>In both cases, the memory read occurs before "zzz".

andrea@inspiron:~ > cat p.c
int *p;
int func()
  int x;
  x = *p;
  __asm__ __volatile__ ("" : : );
  x = *p;
  return x;
andrea@inspiron:~ > gcc -O2 -S p.c
andrea@inspiron:~ > cat p.s
        .file "p.c"
        .version "01.01"
        .align 16
.globl func
        .type func,@function
        pushl %ebp
        movl %esp,%ebp
        movl p,%eax
        movl %ebp,%esp
        popl %ebp
        movl (%eax),%eax
        .size func,.Lfe1-func
        .comm p,4,4
        .ident "GCC: (GNU) 2.95.2 19991024 (release)"


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

This archive was generated by hypermail 2b29 : Thu Sep 07 2000 - 21:00:30 EST