linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rcu: Fix up pending cbs check in rcu_prepare_for_idle
@ 2017-08-07  5:50 Neeraj Upadhyay
  2017-08-07 12:40 ` Paul E. McKenney
  0 siblings, 1 reply; 4+ messages in thread
From: Neeraj Upadhyay @ 2017-08-07  5:50 UTC (permalink / raw)
  To: paulmck, josh, rostedt, mathieu.desnoyers, jiangshanlai
  Cc: linux-kernel, Neeraj Upadhyay

Pending cbs check in rcu_prepare_for_idle is inversed
in the sense that, it should accelerate if there are
pending cbs; but, the check does the opposite. So,
fix it.

Fixes: 15fecf89e46a ("srcu: Abstract multi-tail callback list handling")
Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
---
 kernel/rcu/tree_plugin.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index 908b309..b8f51df 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -1493,7 +1493,7 @@ static void rcu_prepare_for_idle(void)
 	rdtp->last_accelerate = jiffies;
 	for_each_rcu_flavor(rsp) {
 		rdp = this_cpu_ptr(rsp->rda);
-		if (rcu_segcblist_pend_cbs(&rdp->cblist))
+		if (!rcu_segcblist_pend_cbs(&rdp->cblist))
 			continue;
 		rnp = rdp->mynode;
 		raw_spin_lock_rcu_node(rnp); /* irqs already disabled. */
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a
member of the Code Aurora Forum, hosted by The Linux Foundation

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] rcu: Fix up pending cbs check in rcu_prepare_for_idle
  2017-08-07  5:50 [PATCH] rcu: Fix up pending cbs check in rcu_prepare_for_idle Neeraj Upadhyay
@ 2017-08-07 12:40 ` Paul E. McKenney
  2017-08-07 14:01   ` Neeraj Upadhyay
  0 siblings, 1 reply; 4+ messages in thread
From: Paul E. McKenney @ 2017-08-07 12:40 UTC (permalink / raw)
  To: Neeraj Upadhyay
  Cc: josh, rostedt, mathieu.desnoyers, jiangshanlai, linux-kernel

On Mon, Aug 07, 2017 at 11:20:10AM +0530, Neeraj Upadhyay wrote:
> Pending cbs check in rcu_prepare_for_idle is inversed
> in the sense that, it should accelerate if there are
> pending cbs; but, the check does the opposite. So,
> fix it.
> 
> Fixes: 15fecf89e46a ("srcu: Abstract multi-tail callback list handling")
> Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>

Good catch!  Queued for review and testing.

Just out of curiosity, how did you find this one?

							Thanx, Paul

> ---
>  kernel/rcu/tree_plugin.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
> index 908b309..b8f51df 100644
> --- a/kernel/rcu/tree_plugin.h
> +++ b/kernel/rcu/tree_plugin.h
> @@ -1493,7 +1493,7 @@ static void rcu_prepare_for_idle(void)
>  	rdtp->last_accelerate = jiffies;
>  	for_each_rcu_flavor(rsp) {
>  		rdp = this_cpu_ptr(rsp->rda);
> -		if (rcu_segcblist_pend_cbs(&rdp->cblist))
> +		if (!rcu_segcblist_pend_cbs(&rdp->cblist))
>  			continue;
>  		rnp = rdp->mynode;
>  		raw_spin_lock_rcu_node(rnp); /* irqs already disabled. */
> -- 
> QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a
> member of the Code Aurora Forum, hosted by The Linux Foundation
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] rcu: Fix up pending cbs check in rcu_prepare_for_idle
  2017-08-07 12:40 ` Paul E. McKenney
@ 2017-08-07 14:01   ` Neeraj Upadhyay
  2017-08-07 14:09     ` Paul E. McKenney
  0 siblings, 1 reply; 4+ messages in thread
From: Neeraj Upadhyay @ 2017-08-07 14:01 UTC (permalink / raw)
  To: paulmck; +Cc: josh, rostedt, mathieu.desnoyers, jiangshanlai, linux-kernel



On 08/07/2017 06:10 PM, Paul E. McKenney wrote:
> On Mon, Aug 07, 2017 at 11:20:10AM +0530, Neeraj Upadhyay wrote:
>> Pending cbs check in rcu_prepare_for_idle is inversed
>> in the sense that, it should accelerate if there are
>> pending cbs; but, the check does the opposite. So,
>> fix it.
>>
>> Fixes: 15fecf89e46a ("srcu: Abstract multi-tail callback list handling")
>> Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
> Good catch!  Queued for review and testing.
>
> Just out of curiosity, how did you find this one?
>
> 							Thanx, Paul

Hi Paul, found the issue while reading the code.

>
>> ---
>>   kernel/rcu/tree_plugin.h | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
>> index 908b309..b8f51df 100644
>> --- a/kernel/rcu/tree_plugin.h
>> +++ b/kernel/rcu/tree_plugin.h
>> @@ -1493,7 +1493,7 @@ static void rcu_prepare_for_idle(void)
>>   	rdtp->last_accelerate = jiffies;
>>   	for_each_rcu_flavor(rsp) {
>>   		rdp = this_cpu_ptr(rsp->rda);
>> -		if (rcu_segcblist_pend_cbs(&rdp->cblist))
>> +		if (!rcu_segcblist_pend_cbs(&rdp->cblist))
>>   			continue;
>>   		rnp = rdp->mynode;
>>   		raw_spin_lock_rcu_node(rnp); /* irqs already disabled. */
>> -- 
>> QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a
>> member of the Code Aurora Forum, hosted by The Linux Foundation
>>

-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a
member of the Code Aurora Forum, hosted by The Linux Foundation

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] rcu: Fix up pending cbs check in rcu_prepare_for_idle
  2017-08-07 14:01   ` Neeraj Upadhyay
@ 2017-08-07 14:09     ` Paul E. McKenney
  0 siblings, 0 replies; 4+ messages in thread
From: Paul E. McKenney @ 2017-08-07 14:09 UTC (permalink / raw)
  To: Neeraj Upadhyay
  Cc: josh, rostedt, mathieu.desnoyers, jiangshanlai, linux-kernel

On Mon, Aug 07, 2017 at 07:31:27PM +0530, Neeraj Upadhyay wrote:
> 
> 
> On 08/07/2017 06:10 PM, Paul E. McKenney wrote:
> >On Mon, Aug 07, 2017 at 11:20:10AM +0530, Neeraj Upadhyay wrote:
> >>Pending cbs check in rcu_prepare_for_idle is inversed
> >>in the sense that, it should accelerate if there are
> >>pending cbs; but, the check does the opposite. So,
> >>fix it.
> >>
> >>Fixes: 15fecf89e46a ("srcu: Abstract multi-tail callback list handling")
> >>Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
> >Good catch!  Queued for review and testing.
> >
> >Just out of curiosity, how did you find this one?
> 
> Hi Paul, found the issue while reading the code.

Very good, and please feel free to continue reading and finding more
bugs!  ;-)

							Thanx, Paul

> >>---
> >>  kernel/rcu/tree_plugin.h | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >>diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
> >>index 908b309..b8f51df 100644
> >>--- a/kernel/rcu/tree_plugin.h
> >>+++ b/kernel/rcu/tree_plugin.h
> >>@@ -1493,7 +1493,7 @@ static void rcu_prepare_for_idle(void)
> >>  	rdtp->last_accelerate = jiffies;
> >>  	for_each_rcu_flavor(rsp) {
> >>  		rdp = this_cpu_ptr(rsp->rda);
> >>-		if (rcu_segcblist_pend_cbs(&rdp->cblist))
> >>+		if (!rcu_segcblist_pend_cbs(&rdp->cblist))
> >>  			continue;
> >>  		rnp = rdp->mynode;
> >>  		raw_spin_lock_rcu_node(rnp); /* irqs already disabled. */
> >>-- 
> >>QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a
> >>member of the Code Aurora Forum, hosted by The Linux Foundation
> >>
> 
> -- 
> QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a
> member of the Code Aurora Forum, hosted by The Linux Foundation
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-08-07 14:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-07  5:50 [PATCH] rcu: Fix up pending cbs check in rcu_prepare_for_idle Neeraj Upadhyay
2017-08-07 12:40 ` Paul E. McKenney
2017-08-07 14:01   ` Neeraj Upadhyay
2017-08-07 14:09     ` Paul E. McKenney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).