linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] rcu: Remove unnecessary condition in rcu_implicit_dynticks_qs
@ 2016-11-09  6:32 Byungchul Park
  2016-11-09  6:32 ` [PATCH 2/2] rcu: Force resched_cpu when jiffies >= rcu_state.jiffies_resched Byungchul Park
  0 siblings, 1 reply; 7+ messages in thread
From: Byungchul Park @ 2016-11-09  6:32 UTC (permalink / raw)
  To: paulmck, josh, rostedt, mathieu.desnoyers, jiangshanlai; +Cc: linux-kernel

Given two conditions like,

COND 1. jiffies >= rdp->rsp->gp_start + 2 * jiffies_till_sched_qs
COND 2. jiffies >= rdp->rsp->gp_start + jiffies_till_sched_qs

A set of jiffies satisfying COND 2 includes another set satisfying
COND 1. Thus COND 1 can be removed from a condition, (COND 1 || COND 2).

Signed-off-by: Byungchul Park <byungchul.park@lge.com>
---
 kernel/rcu/tree.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 5d80925..d8e8859 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -1220,9 +1220,7 @@ static int rcu_implicit_dynticks_qs(struct rcu_data *rdp,
 	}
 
 	/* And if it has been a really long time, kick the CPU as well. */
-	if (ULONG_CMP_GE(jiffies,
-			 rdp->rsp->gp_start + 2 * jiffies_till_sched_qs) ||
-	    ULONG_CMP_GE(jiffies, rdp->rsp->gp_start + jiffies_till_sched_qs))
+	if (ULONG_CMP_GE(jiffies, rdp->rsp->gp_start + jiffies_till_sched_qs))
 		resched_cpu(rdp->cpu);  /* Force CPU into scheduler. */
 
 	return 0;
-- 
1.9.1

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

* [PATCH 2/2] rcu: Force resched_cpu when jiffies >= rcu_state.jiffies_resched
  2016-11-09  6:32 [PATCH 1/2] rcu: Remove unnecessary condition in rcu_implicit_dynticks_qs Byungchul Park
@ 2016-11-09  6:32 ` Byungchul Park
  2016-11-22  8:12   ` Byungchul Park
  0 siblings, 1 reply; 7+ messages in thread
From: Byungchul Park @ 2016-11-09  6:32 UTC (permalink / raw)
  To: paulmck, josh, rostedt, mathieu.desnoyers, jiangshanlai; +Cc: linux-kernel

Currently rcu code forces CPU into scheduler when jiffies >=
rcu_state.gp_start + jiffies_till_sched_qs, via resched_cpu().

It would be better to force CPU into scheduler when jiffies >=
rcu_state.jiffies_resched, too.

Signed-off-by: Byungchul Park <byungchul.park@lge.com>
---
 kernel/rcu/tree.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index d8e8859..287f468 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -1217,11 +1217,10 @@ static int rcu_implicit_dynticks_qs(struct rcu_data *rdp,
 				   READ_ONCE(*rcrmp) + rdp->rsp->flavor_mask);
 		}
 		rdp->rsp->jiffies_resched += 5; /* Re-enable beating. */
-	}
 
-	/* And if it has been a really long time, kick the CPU as well. */
-	if (ULONG_CMP_GE(jiffies, rdp->rsp->gp_start + jiffies_till_sched_qs))
+		/* And if it has been a really long time, kick the CPU as well. */
 		resched_cpu(rdp->cpu);  /* Force CPU into scheduler. */
+	}
 
 	return 0;
 }
-- 
1.9.1

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

* Re: [PATCH 2/2] rcu: Force resched_cpu when jiffies >= rcu_state.jiffies_resched
  2016-11-09  6:32 ` [PATCH 2/2] rcu: Force resched_cpu when jiffies >= rcu_state.jiffies_resched Byungchul Park
@ 2016-11-22  8:12   ` Byungchul Park
  2016-11-25  8:34     ` Paul E. McKenney
  0 siblings, 1 reply; 7+ messages in thread
From: Byungchul Park @ 2016-11-22  8:12 UTC (permalink / raw)
  To: paulmck, josh, rostedt, mathieu.desnoyers, jiangshanlai; +Cc: linux-kernel

On Wed, Nov 09, 2016 at 03:32:15PM +0900, Byungchul Park wrote:
> Currently rcu code forces CPU into scheduler when jiffies >=
> rcu_state.gp_start + jiffies_till_sched_qs, via resched_cpu().
> 
> It would be better to force CPU into scheduler when jiffies >=
> rcu_state.jiffies_resched, too.

Hello,

I think these two patches are necessary to call resched_cpu() even in
case of jiffies >= rcu_state.jiffies_resched, too. Am I wrong?

It would be appriciated if you let me know if I was wrong.

Thank you,
Byungchul

> 
> Signed-off-by: Byungchul Park <byungchul.park@lge.com>
> ---
>  kernel/rcu/tree.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index d8e8859..287f468 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -1217,11 +1217,10 @@ static int rcu_implicit_dynticks_qs(struct rcu_data *rdp,
>  				   READ_ONCE(*rcrmp) + rdp->rsp->flavor_mask);
>  		}
>  		rdp->rsp->jiffies_resched += 5; /* Re-enable beating. */
> -	}
>  
> -	/* And if it has been a really long time, kick the CPU as well. */
> -	if (ULONG_CMP_GE(jiffies, rdp->rsp->gp_start + jiffies_till_sched_qs))
> +		/* And if it has been a really long time, kick the CPU as well. */
>  		resched_cpu(rdp->cpu);  /* Force CPU into scheduler. */
> +	}
>  
>  	return 0;
>  }
> -- 
> 1.9.1

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

* Re: [PATCH 2/2] rcu: Force resched_cpu when jiffies >= rcu_state.jiffies_resched
  2016-11-22  8:12   ` Byungchul Park
@ 2016-11-25  8:34     ` Paul E. McKenney
  2016-11-26 12:00       ` Paul E. McKenney
  0 siblings, 1 reply; 7+ messages in thread
From: Paul E. McKenney @ 2016-11-25  8:34 UTC (permalink / raw)
  To: Byungchul Park
  Cc: josh, rostedt, mathieu.desnoyers, jiangshanlai, linux-kernel

On Tue, Nov 22, 2016 at 05:12:20PM +0900, Byungchul Park wrote:
> On Wed, Nov 09, 2016 at 03:32:15PM +0900, Byungchul Park wrote:
> > Currently rcu code forces CPU into scheduler when jiffies >=
> > rcu_state.gp_start + jiffies_till_sched_qs, via resched_cpu().
> > 
> > It would be better to force CPU into scheduler when jiffies >=
> > rcu_state.jiffies_resched, too.
> 
> Hello,
> 
> I think these two patches are necessary to call resched_cpu() even in
> case of jiffies >= rcu_state.jiffies_resched, too. Am I wrong?
> 
> It would be appriciated if you let me know if I was wrong.

My current thought is that both the "if" statement and the call to
resched_cpu() should be removed, but I am still testing and working
through the timing.

Either way, I do very much appreciate your having called my attention
to this code!

							Thanx, Paul

> Thank you,
> Byungchul
> 
> > 
> > Signed-off-by: Byungchul Park <byungchul.park@lge.com>
> > ---
> >  kernel/rcu/tree.c | 5 ++---
> >  1 file changed, 2 insertions(+), 3 deletions(-)
> > 
> > diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> > index d8e8859..287f468 100644
> > --- a/kernel/rcu/tree.c
> > +++ b/kernel/rcu/tree.c
> > @@ -1217,11 +1217,10 @@ static int rcu_implicit_dynticks_qs(struct rcu_data *rdp,
> >  				   READ_ONCE(*rcrmp) + rdp->rsp->flavor_mask);
> >  		}
> >  		rdp->rsp->jiffies_resched += 5; /* Re-enable beating. */
> > -	}
> >  
> > -	/* And if it has been a really long time, kick the CPU as well. */
> > -	if (ULONG_CMP_GE(jiffies, rdp->rsp->gp_start + jiffies_till_sched_qs))
> > +		/* And if it has been a really long time, kick the CPU as well. */
> >  		resched_cpu(rdp->cpu);  /* Force CPU into scheduler. */
> > +	}
> >  
> >  	return 0;
> >  }
> > -- 
> > 1.9.1
> 

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

* Re: [PATCH 2/2] rcu: Force resched_cpu when jiffies >= rcu_state.jiffies_resched
  2016-11-25  8:34     ` Paul E. McKenney
@ 2016-11-26 12:00       ` Paul E. McKenney
  2016-11-28  6:46         ` Byungchul Park
  0 siblings, 1 reply; 7+ messages in thread
From: Paul E. McKenney @ 2016-11-26 12:00 UTC (permalink / raw)
  To: Byungchul Park
  Cc: josh, rostedt, mathieu.desnoyers, jiangshanlai, linux-kernel

On Fri, Nov 25, 2016 at 12:34:26AM -0800, Paul E. McKenney wrote:
> On Tue, Nov 22, 2016 at 05:12:20PM +0900, Byungchul Park wrote:
> > On Wed, Nov 09, 2016 at 03:32:15PM +0900, Byungchul Park wrote:
> > > Currently rcu code forces CPU into scheduler when jiffies >=
> > > rcu_state.gp_start + jiffies_till_sched_qs, via resched_cpu().
> > > 
> > > It would be better to force CPU into scheduler when jiffies >=
> > > rcu_state.jiffies_resched, too.
> > 
> > Hello,
> > 
> > I think these two patches are necessary to call resched_cpu() even in
> > case of jiffies >= rcu_state.jiffies_resched, too. Am I wrong?
> > 
> > It would be appriciated if you let me know if I was wrong.
> 
> My current thought is that both the "if" statement and the call to
> resched_cpu() should be removed, but I am still testing and working
> through the timing.
> 
> Either way, I do very much appreciate your having called my attention
> to this code!

And the patch shown below seems to do the trick.  Thoughts?

							Thanx, Paul

------------------------------------------------------------------------

commit d2db185bfee894c573faebed93461e9938bdbb61
Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Date:   Fri Nov 25 00:07:23 2016 -0800

    rcu: Remove short-term CPU kicking
    
    Commit 4914950aaa12d ("rcu: Stop treating in-kernel CPU-bound workloads
    as errors") added a (relatively) short-timeout call to resched_cpu().
    This was inspired by as issue that was fixed by b7e7ade34e61 ("sched/core:
    Fix remote wakeups").  But given that this issue was fixed, it is time
    for the current commit to remove this call to resched_cpu().
    
    Reported-by: Byungchul Park <byungchul.park@lge.com>
    Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 5f4f80d07852..91a68e4e6671 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -1345,12 +1345,6 @@ static int rcu_implicit_dynticks_qs(struct rcu_data *rdp,
 		rdp->rsp->jiffies_resched += 5; /* Re-enable beating. */
 	}
 
-	/* And if it has been a really long time, kick the CPU as well. */
-	if (ULONG_CMP_GE(jiffies,
-			 rdp->rsp->gp_start + 2 * jiffies_till_sched_qs) ||
-	    ULONG_CMP_GE(jiffies, rdp->rsp->gp_start + jiffies_till_sched_qs))
-		resched_cpu(rdp->cpu);  /* Force CPU into scheduler. */
-
 	return 0;
 }
 

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

* Re: [PATCH 2/2] rcu: Force resched_cpu when jiffies >= rcu_state.jiffies_resched
  2016-11-26 12:00       ` Paul E. McKenney
@ 2016-11-28  6:46         ` Byungchul Park
  2016-11-28 10:58           ` Paul E. McKenney
  0 siblings, 1 reply; 7+ messages in thread
From: Byungchul Park @ 2016-11-28  6:46 UTC (permalink / raw)
  To: Paul E. McKenney
  Cc: josh, rostedt, mathieu.desnoyers, jiangshanlai, linux-kernel

On Sat, Nov 26, 2016 at 04:00:46AM -0800, Paul E. McKenney wrote:
> On Fri, Nov 25, 2016 at 12:34:26AM -0800, Paul E. McKenney wrote:
> > On Tue, Nov 22, 2016 at 05:12:20PM +0900, Byungchul Park wrote:
> > > On Wed, Nov 09, 2016 at 03:32:15PM +0900, Byungchul Park wrote:
> > > > Currently rcu code forces CPU into scheduler when jiffies >=
> > > > rcu_state.gp_start + jiffies_till_sched_qs, via resched_cpu().
> > > > 
> > > > It would be better to force CPU into scheduler when jiffies >=
> > > > rcu_state.jiffies_resched, too.
> > > 
> > > Hello,
> > > 
> > > I think these two patches are necessary to call resched_cpu() even in
> > > case of jiffies >= rcu_state.jiffies_resched, too. Am I wrong?
> > > 
> > > It would be appriciated if you let me know if I was wrong.
> > 
> > My current thought is that both the "if" statement and the call to
> > resched_cpu() should be removed, but I am still testing and working
> > through the timing.
> > 
> > Either way, I do very much appreciate your having called my attention
> > to this code!
> 
> And the patch shown below seems to do the trick.  Thoughts?

Hello,

I see.. I didn't check the log 'rcu: Stop treating in-kernel CPU-bound
workloads as errors'.

If you are convinced to remove them, no objection.

Thank you,
Byungchul

> 
> 							Thanx, Paul
> 
> ------------------------------------------------------------------------
> 
> commit d2db185bfee894c573faebed93461e9938bdbb61
> Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> Date:   Fri Nov 25 00:07:23 2016 -0800
> 
>     rcu: Remove short-term CPU kicking
>     
>     Commit 4914950aaa12d ("rcu: Stop treating in-kernel CPU-bound workloads
>     as errors") added a (relatively) short-timeout call to resched_cpu().
>     This was inspired by as issue that was fixed by b7e7ade34e61 ("sched/core:
>     Fix remote wakeups").  But given that this issue was fixed, it is time
>     for the current commit to remove this call to resched_cpu().
>     
>     Reported-by: Byungchul Park <byungchul.park@lge.com>
>     Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> 
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index 5f4f80d07852..91a68e4e6671 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -1345,12 +1345,6 @@ static int rcu_implicit_dynticks_qs(struct rcu_data *rdp,
>  		rdp->rsp->jiffies_resched += 5; /* Re-enable beating. */
>  	}
>  
> -	/* And if it has been a really long time, kick the CPU as well. */
> -	if (ULONG_CMP_GE(jiffies,
> -			 rdp->rsp->gp_start + 2 * jiffies_till_sched_qs) ||
> -	    ULONG_CMP_GE(jiffies, rdp->rsp->gp_start + jiffies_till_sched_qs))
> -		resched_cpu(rdp->cpu);  /* Force CPU into scheduler. */
> -
>  	return 0;
>  }
>  

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

* Re: [PATCH 2/2] rcu: Force resched_cpu when jiffies >= rcu_state.jiffies_resched
  2016-11-28  6:46         ` Byungchul Park
@ 2016-11-28 10:58           ` Paul E. McKenney
  0 siblings, 0 replies; 7+ messages in thread
From: Paul E. McKenney @ 2016-11-28 10:58 UTC (permalink / raw)
  To: Byungchul Park
  Cc: josh, rostedt, mathieu.desnoyers, jiangshanlai, linux-kernel

On Mon, Nov 28, 2016 at 03:46:39PM +0900, Byungchul Park wrote:
> On Sat, Nov 26, 2016 at 04:00:46AM -0800, Paul E. McKenney wrote:
> > On Fri, Nov 25, 2016 at 12:34:26AM -0800, Paul E. McKenney wrote:
> > > On Tue, Nov 22, 2016 at 05:12:20PM +0900, Byungchul Park wrote:
> > > > On Wed, Nov 09, 2016 at 03:32:15PM +0900, Byungchul Park wrote:
> > > > > Currently rcu code forces CPU into scheduler when jiffies >=
> > > > > rcu_state.gp_start + jiffies_till_sched_qs, via resched_cpu().
> > > > > 
> > > > > It would be better to force CPU into scheduler when jiffies >=
> > > > > rcu_state.jiffies_resched, too.
> > > > 
> > > > Hello,
> > > > 
> > > > I think these two patches are necessary to call resched_cpu() even in
> > > > case of jiffies >= rcu_state.jiffies_resched, too. Am I wrong?
> > > > 
> > > > It would be appriciated if you let me know if I was wrong.
> > > 
> > > My current thought is that both the "if" statement and the call to
> > > resched_cpu() should be removed, but I am still testing and working
> > > through the timing.
> > > 
> > > Either way, I do very much appreciate your having called my attention
> > > to this code!
> > 
> > And the patch shown below seems to do the trick.  Thoughts?
> 
> Hello,
> 
> I see.. I didn't check the log 'rcu: Stop treating in-kernel CPU-bound
> workloads as errors'.
> 
> If you are convinced to remove them, no objection.

It is quite possible that additional time-related adjustments are needed,
but this change is a step in the right direction.

							Thanx, Paul

> Thank you,
> Byungchul
> 
> > 
> > 							Thanx, Paul
> > 
> > ------------------------------------------------------------------------
> > 
> > commit d2db185bfee894c573faebed93461e9938bdbb61
> > Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > Date:   Fri Nov 25 00:07:23 2016 -0800
> > 
> >     rcu: Remove short-term CPU kicking
> >     
> >     Commit 4914950aaa12d ("rcu: Stop treating in-kernel CPU-bound workloads
> >     as errors") added a (relatively) short-timeout call to resched_cpu().
> >     This was inspired by as issue that was fixed by b7e7ade34e61 ("sched/core:
> >     Fix remote wakeups").  But given that this issue was fixed, it is time
> >     for the current commit to remove this call to resched_cpu().
> >     
> >     Reported-by: Byungchul Park <byungchul.park@lge.com>
> >     Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > 
> > diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> > index 5f4f80d07852..91a68e4e6671 100644
> > --- a/kernel/rcu/tree.c
> > +++ b/kernel/rcu/tree.c
> > @@ -1345,12 +1345,6 @@ static int rcu_implicit_dynticks_qs(struct rcu_data *rdp,
> >  		rdp->rsp->jiffies_resched += 5; /* Re-enable beating. */
> >  	}
> >  
> > -	/* And if it has been a really long time, kick the CPU as well. */
> > -	if (ULONG_CMP_GE(jiffies,
> > -			 rdp->rsp->gp_start + 2 * jiffies_till_sched_qs) ||
> > -	    ULONG_CMP_GE(jiffies, rdp->rsp->gp_start + jiffies_till_sched_qs))
> > -		resched_cpu(rdp->cpu);  /* Force CPU into scheduler. */
> > -
> >  	return 0;
> >  }
> >  
> 

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

end of thread, other threads:[~2016-11-28 10:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-09  6:32 [PATCH 1/2] rcu: Remove unnecessary condition in rcu_implicit_dynticks_qs Byungchul Park
2016-11-09  6:32 ` [PATCH 2/2] rcu: Force resched_cpu when jiffies >= rcu_state.jiffies_resched Byungchul Park
2016-11-22  8:12   ` Byungchul Park
2016-11-25  8:34     ` Paul E. McKenney
2016-11-26 12:00       ` Paul E. McKenney
2016-11-28  6:46         ` Byungchul Park
2016-11-28 10:58           ` 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).