[EMAIL PROTECTED] wrote: > do { > oldvalue = ll(addr) > newvalue = ... oldvalue ... > } while (!sc(addr, oldvalue, newvalue)) > > Where sc() could be a cmpxchg. But, more importantly, if the > architecture did implement LL/SC, it could be a "try plain SC; if > that fails try CMPXCHG built out of LL/SC; if that fails, loop"
If sc() is implemented with cmpxchg(), then this is a very silly piece of code. cmpxchg() returns the current value if it fails, rendering a repetition of ll() pointless. In some circumstances, you should really do it by putting the cmpxchg() up front with what you expect the most likely substitution to be, and that then doesn't require the initial load. David - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/