Since your main concern seems to be simplicity, the code can remain
the way it is and be far more readable with, e.g.,
/* Aquire lock1 while holding lock2--reverse order. */
#define spin_reverse_lock(lock1,lock2) \
if (unlikely(!spin_trylock(&lock1))) { \
spin_unlock(&lock2); \
spin_lock(&lock1); \
spin_lock(&lock2); \
}
You can't argue for simple in favor of increasing lock contention,
but you can keep it readable.
-josh
-
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/