lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20110916164013.0f08f0da@wang-bj-intel>
Date:	Fri, 16 Sep 2011 16:40:13 -0400
From:	xingchao <xingchao.wang@...el.com>
To:	Peter Zijlstra <peterz@...radead.org>
CC:	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"mingo@...e.hu" <mingo@...e.hu>,
	"yong.zhang0@...il.com" <yong.zhang0@...il.com>,
	Paul Turner <pjt@...gle.com>
Subject: Re: [PATCH] cfs: remove unused 'if' condition checking

On Fri, 16 Sep 2011 16:38:32 +0800
Peter Zijlstra <peterz@...radead.org> wrote:

> Thanks, queued it as:
> 
> ---
> Subject: sched: Remove redundant test in check_preempt_tick()
> From: Wang Xingchao <xingchao.wang@...el.com>
> Date: Fri, 16 Sep 2011 13:35:52 -0400
> 
> The caller already checks for nr_running > 1, therefore we don't have
> to do so again.
> 
> Signed-off-by: Wang Xingchao <xingchao.wang@...el.com>
> Reviewed-by: Paul Turner <pjt@...gle.com>
> Signed-off-by: Peter Zijlstra <a.p.zijlstra@...llo.nl>
> Link:
> http://lkml.kernel.org/r/1316194552-12019-1-git-send-email-xingchao.wang@intel.com
> --- kernel/sched_fair.c |   16 ++++++++--------
>  1 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
> index 1ca2cd4..fef0bfd 100644
> --- a/kernel/sched_fair.c
> +++ b/kernel/sched_fair.c
> @@ -1106,6 +1106,8 @@ static void
>  check_preempt_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr)
>  {
>  	unsigned long ideal_runtime, delta_exec;
> +	struct sched_entity *se;
> +	s64 delta;
>  
>  	ideal_runtime = sched_slice(cfs_rq, curr);
>  	delta_exec = curr->sum_exec_runtime -
> curr->prev_sum_exec_runtime; @@ -1127,16 +1129,14 @@
> check_preempt_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr)
> if (delta_exec < sysctl_sched_min_granularity) return;
>  
> -	if (cfs_rq->nr_running > 1) {
> -		struct sched_entity *se =
> __pick_first_entity(cfs_rq);
> -		s64 delta = curr->vruntime - se->vruntime;
> +	se = __pick_first_entity(cfs_rq);
> +	delta = curr->vruntime - se->vruntime;
>  
> -		if (delta < 0)
> -			return;
> +	if (delta < 0)
> +		return;
>  
> -		if (delta > ideal_runtime)
> -			resched_task(rq_of(cfs_rq)->curr);
> -	}
> +	if (delta > ideal_runtime)
> +		resched_task(rq_of(cfs_rq)->curr);
>  }
>  
>  static void

oh, so fast Peter, thank you. Then it's no need to take the V2 patch.

--xingchao

>From 3192939226ba274b5b9a32f07fc10025bb836ad3 Mon Sep 17 00:00:00 2001
From: Wang Xingchao <xingchao.wang@...el.com>
Date: Mon, 12 Sep 2011 14:30:16 +0800
Subject: [V2 PATCH] sched:remove extra nr_running check in
check_preempt_tick

nr_running must be more than 1, remove the checking.
We already test for nr_running > 1 in entity_tick(),
so it's no need to recheck it within check_preempt_tick().

Reviewed-by: Paul Turner <pjt@...gle.com>
Reviewed-by: yong.zhang0@...il.com
Signed-off-by: Wang Xingchao <xingchao.wang@...el.com>
---
 kernel/sched_fair.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 1ca2cd4..fef0bfd 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1106,6 +1106,8 @@ static void
 check_preempt_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr)
 {
 	unsigned long ideal_runtime, delta_exec;
+	struct sched_entity *se;
+	s64 delta;
 
 	ideal_runtime = sched_slice(cfs_rq, curr);
 	delta_exec = curr->sum_exec_runtime -
curr->prev_sum_exec_runtime; @@ -1127,16 +1129,14 @@
check_preempt_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr) if
(delta_exec < sysctl_sched_min_granularity) return;
 
-	if (cfs_rq->nr_running > 1) {
-		struct sched_entity *se = __pick_first_entity(cfs_rq);
-		s64 delta = curr->vruntime - se->vruntime;
+	se = __pick_first_entity(cfs_rq);
+	delta = curr->vruntime - se->vruntime;
 
-		if (delta < 0)
-			return;
+	if (delta < 0)
+		return;
 
-		if (delta > ideal_runtime)
-			resched_task(rq_of(cfs_rq)->curr);
-	}
+	if (delta > ideal_runtime)
+		resched_task(rq_of(cfs_rq)->curr);
 }
 
 static void
-- 
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ