Simplify qsbr online condition
authorMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Wed, 14 Apr 2010 16:56:53 +0000 (12:56 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Wed, 14 Apr 2010 16:56:53 +0000 (12:56 -0400)
commit92cb20a84557a365cabcde63cb19809a7cbb2651
treeacb26d538e55d856f60ff6f988896e21fd94b9cc
parent18c3778a6e548f0926cada96db00f8da7cc81454
Simplify qsbr online condition

Alan Stern wrote:

>       return v && (v - rcu_gp_ctr > ULONG_MAX / 2);
>
> Wouldn't it be better to write:
>
>       return v != 0 && v != rcu_gp_ctr;
>
> or something equivalent?  The point is, it's foolish to return 0 when
> rcu_gp_ctr has wrapped around to below v.  This can happen only when
> rcu_thread_online() is delayed (as by preemption), in which case we
> know that there's a good chance the algorithm will fail.  My version of
> the test eliminates the possibility of this failure, although it
> doesn't eliminate the possibility that rcu_gp_ctr has wrapped around so
> far that it is equal to v.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
urcu-qsbr-static.h
This page took 0.02499 seconds and 4 git commands to generate.