qsbr: micro optimization of the gp use.
authorMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Thu, 17 Sep 2009 12:38:06 +0000 (08:38 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Thu, 17 Sep 2009 12:38:06 +0000 (08:38 -0400)
commitab179a1705ee5d662c6a7964645077980096e134
tree124296725b1e67de5086789f190184733788b0f7
parent8f50d1ce191ad5f85384c0afbf1ac5b7516ea79f
qsbr: micro optimization of the gp use.

Follow-up on 1a80f3: since now `0' for a gp counter means "offline", just
be sure that the global GP counter is never zero. To achieve that, let its
first value ever be one, and increment it 2 by 2 like previously done.
Note that it internaly uses the fact that signed integers wraps (which the
previous code already assumed anyways) but this is undefined behaviour in
C. Using unsigned longs would probably be more portable.

This way, setting the cpu online, marking a quiescent state is just a
matter of copying the global gp counter instead of incrementing it by one.

This saves one CPU instruction, and supposedly even register use for
architectures providing memory to memory copy operands.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
urcu-qsbr-static.h
urcu-qsbr.c
This page took 0.025162 seconds and 4 git commands to generate.