[ovs-dev] [PATCH 07/18] lib/ovs-thread: Avoid atomic read in ovsthread_once_start().

Ben Pfaff blp at nicira.com
Thu Aug 28 16:42:37 UTC 2014


On Fri, Aug 22, 2014 at 01:58:18PM -0700, Jarno Rajahalme wrote:
> Avoiding the atomic read may help if a function using
> ovsthread_once_start() is ever called in a loop, as the new
> 'maybe_not_done' can be kept in a register.  The atomic read will
> still be done as long as 'maybe_not_done' is true.  Since
> 'maybe_not_done' is not an atomic variable, whis may happen
> indefinitely, but if a loop starts with 'maybe_not_done' as false, no
> atomic read operations are needed.
> 
> Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>

It seems reasonable to have a cheaper test like this, but I don't think
that if we do that we need to also inline the more expensive test.  In
other words, I think we could drop the call to
ovsthread_once_is_done__() from ovsthread_once_start().  (After that we
can move ovsthread_once_is_done__() into ovs-thread.c.)



More information about the dev mailing list