Messages in this thread |  | | | Date | Sat, 27 Nov 1999 00:02:41 +0100 (CET) | | From | Ingo Molnar <> | | Subject | Re: 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/
|  |