RE: Atomic operations

From: Gregory Giguashvili (Gregoryg@ParadigmGeo.com)
Date: Tue Jun 04 2002 - 04:23:28 EST


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/



This archive was generated by hypermail 2b29 : Fri Jun 07 2002 - 22:00:19 EST