Re: [PATCH] kernel/rcutree.c: deem to be lazy if there are no callbacks.

From: Chen Gang
Date: Tue Aug 20 2013 - 00:31:17 EST


On 08/20/2013 12:10 PM, Paul E. McKenney wrote:
> On Tue, Aug 20, 2013 at 11:50:02AM +0800, Chen Gang wrote:
>> According to the comment above rcu_cpu_has_callbacks(): "If there are
>> no callbacks, all of them are deemed to be lazy".
>>
>> So when both 'hc' and 'al' are false, '*all_lazy' should be true, not
>> false.
>
> If there are no callbacks, what must the value of "al" be at this
> point in the code? Given this, what is the effect of your patch?
>

Hmm... I find it by reading code, the 'C code' says that 'hc' and 'al'
has no relationships with each other, so for a reader they can assume
when 'hc' is false, 'al' can be either 'true' or 'false'.

> Thanx, Paul
>
>> Signed-off-by: Chen Gang <gang.chen@xxxxxxxxxxx>
>> ---
>> kernel/rcutree.c | 2 +-
>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/kernel/rcutree.c b/kernel/rcutree.c
>> index 5b53a89..9ee9565 100644
>> --- a/kernel/rcutree.c
>> +++ b/kernel/rcutree.c
>> @@ -2725,7 +2725,7 @@ static int rcu_cpu_has_callbacks(int cpu, bool *all_lazy)
>> hc = true;
>> }
>> if (all_lazy)
>> - *all_lazy = al;
>> + *all_lazy = !hc ? true : al;
>> return hc;
>> }
>>
>> --
>> 1.7.7.6
>>
>
>
>


--
Chen Gang
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/