[ltt-dev] [PATCH] urcu-qsbr: avoid useless futex wakeups and burning CPU for long grace periods
Paolo Bonzini
pbonzini at redhat.com
Wed Aug 17 03:39:28 EDT 2011
On 08/16/2011 05:29 AM, Mathieu Desnoyers wrote:
>> > + :: (in_registry[0] == 0&& in_registry[1] == 0) ->
>> > +progress:
>> > +#ifndef INJ_LATE_DEC
>> > + gp_futex = 0;
>> > +#endif
>> > + gp = !gp;
> Shouldn't you flip the gp for both steps of synchronize_rcu ? Here, it
> looks like you only flip gp after the reader passes through both of the
> checks, which defeats the purpose the 2-phase grace period.
Other comments are more or less trivial (i.e. you are right :)), so I'll
just answer a few.
Here, I flip gp after both readers have passed through a grace period.
Note that the waiter process doesn't model synchronize_rcu, it models
update_counter_and_wait.
This is because if you have only one writer, and no threads going
online/offline, there is no difference between an infinite sequence of
synchronize_rcu and an infinite sequence of update_counter_and_wait: the
latter is just two copies of the former, back to back.
> for consistency, you seem to use "in_registry[1]" and "in_registry[1] ==
> 1" for pretty much the same thing. Is there a reason why they differ ?
No, I should always use == 1.
Paolo
More information about the lttng-dev
mailing list