[ltt-dev] [PATCH] urcu-qsbr: avoid useless futex wakeups and burning CPU for long grace periods

Mathieu Desnoyers compudj at krystal.dyndns.org
Wed Aug 17 05:41:56 EDT 2011


* Paolo Bonzini (pbonzini at redhat.com) wrote:
> 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.

I see.

>
> 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.

Yep, indeed!

>
>> 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.

OK,

Thanks!

Mathieu

>
> Paolo
>

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com




More information about the lttng-dev mailing list