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] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 19 Nov 2009 23:51:53 +0100
From:	Peter Zijlstra <peterz@...radead.org>
To:	Jupyung Lee <jupyung@...il.com>
Cc:	LKML <linux-kernel@...r.kernel.org>, Ingo Molnar <mingo@...hat.com>
Subject: Re: [PATCH 1/1] sched: move update_curr() in
 check_preempt_wakeup() to avoid redundant call

On Tue, 2009-11-17 at 18:51 +0900, Jupyung Lee wrote:
> Impact: micro-optimization
> 
> If a RT task is woken up while a non-RT task is running, 
> check_preempt_wakeup() is called to check whether the new task can 
> preempt the old task. The function returns quickly without going deeper 
> because it is apparent that a RT task can always preempt a non-RT task.
> 
> In this situation, check_preempt_wakeup() always calls update_curr() to
> update vruntime value of the currently running task. However, the function
> call is unnecessary and redundant at that moment because (1) a non-RT task can 
> always be preempted by a RT task regardless of its vruntime value, and
> (2) update_curr() will be called shortly when the context switch between two occurs.
> 
> By moving update_curr() in check_preempt_wakeup(), we can avoid redundant
> call to update_curr(), slightly reducing the time taken to wake up RT tasks.

So far so good, but then you let me figure out why you placed it where
you did.

Anyway, I think the patch is good and took the patch, thanks!

> Signed-off-by: Jupyung Lee <jupyung@...il.com>
> ---
>  kernel/sched_fair.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
> index 37087a7..32256c0 100644
> --- a/kernel/sched_fair.c
> +++ b/kernel/sched_fair.c
> @@ -1596,8 +1596,6 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_
>  	int sync = wake_flags & WF_SYNC;
>  	int scale = cfs_rq->nr_running >= sched_nr_latency;
>  
> -	update_curr(cfs_rq);
> -
>  	if (unlikely(rt_prio(p->prio))) {
>  		resched_task(curr);
>  		return;
> @@ -1655,6 +1653,8 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_
>  
>  	BUG_ON(!pse);
>  
> +	update_curr(cfs_rq);
> +
>  	if (wakeup_preempt_entity(se, pse) == 1) {
>  		resched_task(curr);
>  		/*


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