Re: [PATCH 3/3] ring-buffer: add design document

From: Huang Ying
Date: Wed Jun 10 2009 - 20:51:22 EST


On Thu, 2009-06-11 at 03:53 +0800, Steven Rostedt wrote:
> +
> +cmpxchg - hardware assisted atomic transaction that performs the following:
> +
> + A = B iff previous A == C
> +
> + R = cmpxchg(A, C, B) is saying that we replace A with B if and only if
> + current A is equal to C, and we put the old (current) A into R
> +
> + R gets the previous A regardless if A is updated with B or not.
> +
> + To see if the update was successful a compare of R == C may be used.

As far as I know, some architectures have no hardware assisted (NMI
safe) cmpxchg. Is it OK to use cmpxchg in architecture-independent code?

Best Regards,
Huang Ying


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/