RE: Atomic operations

Gregory Giguashvili (Gregoryg@ParadigmGeo.com)
Tue, 4 Jun 2002 11:23:28 +0200


Hello,

Thanks a lot for your help to all of you...

The last thing, I want to make sure of, is that the following type of code:

int atomic_xadd(int i, atomic_t *v)
{
int ret;
__asm__(LOCK "xaddl %1,%0"
: "=m" (v->counter), "=r" (ret)
: "0" (v->counter), "1" (i));
return ret;
}

is less efficient than this one:

int atomic_xadd(int i, atomic_t *v)
{
asm volatile(LOCK "xaddl %1,%0"
: "+m" (v->counter), "+r" (i));
return i;
}

The reason for it is that the first one is more easy to read (at least for
me as a beginner).

Thanks again for your precious comments.
Best,
Giga
-
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/