linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] sched: make update_min_vruntime() more readable
@ 2015-07-05  9:33 byungchul.park
  2015-07-06 11:26 ` Peter Zijlstra
  2016-09-05 11:53 ` [tip:sched/core] sched/fair: Make " tip-bot for Byungchul Park
  0 siblings, 2 replies; 4+ messages in thread
From: byungchul.park @ 2015-07-05  9:33 UTC (permalink / raw)
  To: mingo, peterz; +Cc: minchan.kim, linux-kernel, Byungchul Park

From: Byungchul Park <byungchul.park@lge.com>

update_min_vruntime() condition flow can be simpler

Signed-off-by: Byungchul Park <byungchul.park@lge.com>
---
 kernel/sched/fair.c |   17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 3d57cc0..59de964 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -463,20 +463,17 @@ static void update_min_vruntime(struct cfs_rq *cfs_rq)
 {
 	u64 vruntime = cfs_rq->min_vruntime;
 
-	if (cfs_rq->curr)
-		vruntime = cfs_rq->curr->vruntime;
-
 	if (cfs_rq->rb_leftmost) {
 		struct sched_entity *se = rb_entry(cfs_rq->rb_leftmost,
 						   struct sched_entity,
 						   run_node);
 
-		if (!cfs_rq->curr)
-			vruntime = se->vruntime;
-		else
-			vruntime = min_vruntime(vruntime, se->vruntime);
+		vruntime = se->vruntime;
 	}
 
+	if (cfs_rq->curr)
+		vruntime = min_vruntime(vruntime, cfs_rq->curr->vruntime);
+
 	/* ensure we never gain time by being placed backwards. */
 	cfs_rq->min_vruntime = max_vruntime(cfs_rq->min_vruntime, vruntime);
 #ifndef CONFIG_64BIT
@@ -5552,7 +5549,7 @@ static bool yield_to_task_fair(struct rq *rq, struct task_struct *p, bool preemp
  *
  * The adjacency matrix of the resulting graph is given by:
  *
- *             log_2 n     
+ *             log_2 n
  *   A_i,j = \Union     (i % 2^k == 0) && i / 2^(k+1) == j / 2^(k+1)  (6)
  *             k = 0
  *
@@ -5598,7 +5595,7 @@ static bool yield_to_task_fair(struct rq *rq, struct task_struct *p, bool preemp
  *
  * [XXX write more on how we solve this.. _after_ merging pjt's patches that
  *      rewrite all of this once again.]
- */ 
+ */
 
 static unsigned long __read_mostly max_load_balance_interval = HZ/10;
 
@@ -6337,7 +6334,7 @@ void update_group_capacity(struct sched_domain *sd, int cpu)
 		/*
 		 * !SD_OVERLAP domains can assume that child groups
 		 * span the current group.
-		 */ 
+		 */
 
 		group = child->groups;
 		do {
-- 
1.7.9.5


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

* Re: [PATCH 1/1] sched: make update_min_vruntime() more readable
  2015-07-05  9:33 [PATCH 1/1] sched: make update_min_vruntime() more readable byungchul.park
@ 2015-07-06 11:26 ` Peter Zijlstra
  2015-07-06 11:57   ` Byungchul Park
  2016-09-05 11:53 ` [tip:sched/core] sched/fair: Make " tip-bot for Byungchul Park
  1 sibling, 1 reply; 4+ messages in thread
From: Peter Zijlstra @ 2015-07-06 11:26 UTC (permalink / raw)
  To: byungchul.park; +Cc: mingo, minchan.kim, linux-kernel

On Sun, Jul 05, 2015 at 06:33:48PM +0900, byungchul.park@lge.com wrote:
> From: Byungchul Park <byungchul.park@lge.com>
> 
> update_min_vruntime() condition flow can be simpler

This changelog needs help; a few more words on why this is correct and
simpler would not go amiss, and you should mention you're deleting some
spurious trailing whitespace.

> Signed-off-by: Byungchul Park <byungchul.park@lge.com>
> ---
>  kernel/sched/fair.c |   17 +++++++----------
>  1 file changed, 7 insertions(+), 10 deletions(-)
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 3d57cc0..59de964 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -463,20 +463,17 @@ static void update_min_vruntime(struct cfs_rq *cfs_rq)
>  {
>  	u64 vruntime = cfs_rq->min_vruntime;
>  
> -	if (cfs_rq->curr)
> -		vruntime = cfs_rq->curr->vruntime;
> -
>  	if (cfs_rq->rb_leftmost) {
>  		struct sched_entity *se = rb_entry(cfs_rq->rb_leftmost,
>  						   struct sched_entity,
>  						   run_node);
>  
> -		if (!cfs_rq->curr)
> -			vruntime = se->vruntime;
> -		else
> -			vruntime = min_vruntime(vruntime, se->vruntime);
> +		vruntime = se->vruntime;
>  	}
>  
> +	if (cfs_rq->curr)
> +		vruntime = min_vruntime(vruntime, cfs_rq->curr->vruntime);
> +
>  	/* ensure we never gain time by being placed backwards. */
>  	cfs_rq->min_vruntime = max_vruntime(cfs_rq->min_vruntime, vruntime);
>  #ifndef CONFIG_64BIT

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

* Re: [PATCH 1/1] sched: make update_min_vruntime() more readable
  2015-07-06 11:26 ` Peter Zijlstra
@ 2015-07-06 11:57   ` Byungchul Park
  0 siblings, 0 replies; 4+ messages in thread
From: Byungchul Park @ 2015-07-06 11:57 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: mingo, linux-kernel

On Mon, Jul 06, 2015 at 01:26:53PM +0200, Peter Zijlstra wrote:
> On Sun, Jul 05, 2015 at 06:33:48PM +0900, byungchul.park@lge.com wrote:
> > From: Byungchul Park <byungchul.park@lge.com>
> > 
> > update_min_vruntime() condition flow can be simpler
> 
> This changelog needs help; a few more words on why this is correct and
> simpler would not go amiss, and you should mention you're deleting some
> spurious trailing whitespace.

hello,

thank you for your advice!
i will add a supplementary explanation.

thank you,
byungchul

> 
> > Signed-off-by: Byungchul Park <byungchul.park@lge.com>
> > ---
> >  kernel/sched/fair.c |   17 +++++++----------
> >  1 file changed, 7 insertions(+), 10 deletions(-)
> > 
> > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> > index 3d57cc0..59de964 100644
> > --- a/kernel/sched/fair.c
> > +++ b/kernel/sched/fair.c
> > @@ -463,20 +463,17 @@ static void update_min_vruntime(struct cfs_rq *cfs_rq)
> >  {
> >  	u64 vruntime = cfs_rq->min_vruntime;
> >  
> > -	if (cfs_rq->curr)
> > -		vruntime = cfs_rq->curr->vruntime;
> > -
> >  	if (cfs_rq->rb_leftmost) {
> >  		struct sched_entity *se = rb_entry(cfs_rq->rb_leftmost,
> >  						   struct sched_entity,
> >  						   run_node);
> >  
> > -		if (!cfs_rq->curr)
> > -			vruntime = se->vruntime;
> > -		else
> > -			vruntime = min_vruntime(vruntime, se->vruntime);
> > +		vruntime = se->vruntime;
> >  	}
> >  
> > +	if (cfs_rq->curr)
> > +		vruntime = min_vruntime(vruntime, cfs_rq->curr->vruntime);
> > +
> >  	/* ensure we never gain time by being placed backwards. */
> >  	cfs_rq->min_vruntime = max_vruntime(cfs_rq->min_vruntime, vruntime);
> >  #ifndef CONFIG_64BIT
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

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

* [tip:sched/core] sched/fair: Make update_min_vruntime() more readable
  2015-07-05  9:33 [PATCH 1/1] sched: make update_min_vruntime() more readable byungchul.park
  2015-07-06 11:26 ` Peter Zijlstra
@ 2016-09-05 11:53 ` tip-bot for Byungchul Park
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Byungchul Park @ 2016-09-05 11:53 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mingo, tglx, byungchul.park, torvalds, peterz, hpa, linux-kernel

Commit-ID:  97a7142f157a6361a659ff3eec2c3cf636bd7490
Gitweb:     http://git.kernel.org/tip/97a7142f157a6361a659ff3eec2c3cf636bd7490
Author:     Byungchul Park <byungchul.park@lge.com>
AuthorDate: Sun, 5 Jul 2015 18:33:48 +0900
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 5 Sep 2016 13:29:41 +0200

sched/fair: Make update_min_vruntime() more readable

The update_min_vruntime() control flow can be simplified.

Signed-off-by: Byungchul Park <byungchul.park@lge.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: minchan.kim@lge.com
Link: http://lkml.kernel.org/r/1436088829-25768-1-git-send-email-byungchul.park@lge.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/sched/fair.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 61d4854..9a18aae 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -464,20 +464,17 @@ static void update_min_vruntime(struct cfs_rq *cfs_rq)
 {
 	u64 vruntime = cfs_rq->min_vruntime;
 
-	if (cfs_rq->curr)
-		vruntime = cfs_rq->curr->vruntime;
-
 	if (cfs_rq->rb_leftmost) {
 		struct sched_entity *se = rb_entry(cfs_rq->rb_leftmost,
 						   struct sched_entity,
 						   run_node);
 
-		if (!cfs_rq->curr)
-			vruntime = se->vruntime;
-		else
-			vruntime = min_vruntime(vruntime, se->vruntime);
+		vruntime = se->vruntime;
 	}
 
+	if (cfs_rq->curr)
+		vruntime = min_vruntime(vruntime, cfs_rq->curr->vruntime);
+
 	/* ensure we never gain time by being placed backwards. */
 	cfs_rq->min_vruntime = max_vruntime(cfs_rq->min_vruntime, vruntime);
 #ifndef CONFIG_64BIT
@@ -5988,7 +5985,7 @@ static bool yield_to_task_fair(struct rq *rq, struct task_struct *p, bool preemp
  *
  * The adjacency matrix of the resulting graph is given by:
  *
- *             log_2 n     
+ *             log_2 n
  *   A_i,j = \Union     (i % 2^k == 0) && i / 2^(k+1) == j / 2^(k+1)  (6)
  *             k = 0
  *
@@ -6034,7 +6031,7 @@ static bool yield_to_task_fair(struct rq *rq, struct task_struct *p, bool preemp
  *
  * [XXX write more on how we solve this.. _after_ merging pjt's patches that
  *      rewrite all of this once again.]
- */ 
+ */
 
 static unsigned long __read_mostly max_load_balance_interval = HZ/10;
 
@@ -6696,7 +6693,7 @@ void update_group_capacity(struct sched_domain *sd, int cpu)
 		/*
 		 * !SD_OVERLAP domains can assume that child groups
 		 * span the current group.
-		 */ 
+		 */
 
 		group = child->groups;
 		do {

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

end of thread, other threads:[~2016-09-05 11:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-05  9:33 [PATCH 1/1] sched: make update_min_vruntime() more readable byungchul.park
2015-07-06 11:26 ` Peter Zijlstra
2015-07-06 11:57   ` Byungchul Park
2016-09-05 11:53 ` [tip:sched/core] sched/fair: Make " tip-bot for Byungchul Park

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