lkml.org 
[lkml]   [1999]   [Nov]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: spin_unlock optimization(i386)

duh, the code is ok, but this pseudocode is buggy:

> CPU0 CPU1
>
> for (;;) { for (;;) {
> i++; a = j;
> j++; b = i;
> } if (a < b)
> BUG()
> }

the correct one is:

CPU0 CPU1

for (;;) { for (;;) {
i++; b = j;
j++; a = i;
} if (a < b)
BUG();
}
the 'symmetric' test:

CPU0 CPU1

for (;;) { for (;;) {
i1++; i2++;
j1++; j2++;
b = j2; b = j1;
a = i2; a = i1;
if (a < b) if (a < b)
BUG(); BUG();
} }

[plus the real code deals with the overflow case as well]

-- mingo


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:55    [from the cache]
©2003-2011 Jasper Spaans