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:	Tue, 31 May 2011 16:31:55 -0400
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Hillf Danton <dhillf@...il.com>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	Mike Galbraith <efault@....de>,
	Yong Zhang <yong.zhang0@...il.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Ingo Molnar <mingo@...e.hu>
Subject: Re: [PATCH] sched: check and preempt the current task at right
 place

On Tue, 2011-05-31 at 21:04 +0800, Hillf Danton wrote:
> When switching a task to RT, it is the right place to preempt the current
> running task if the task is not running. Same scenario also rises when the
> priority of task has changed.
> 
> Signed-off-by: Hillf Danton <dhillf@...il.com>
> ---
>  kernel/sched_rt.c |   19 +++----------------
>  1 files changed, 3 insertions(+), 16 deletions(-)
> 
> diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
> index 88725c9..4a9553e 100644
> --- a/kernel/sched_rt.c
> +++ b/kernel/sched_rt.c
> @@ -1671,25 +1671,13 @@ static inline void init_sched_rt_class(void)
>   */
>  static void switched_to_rt(struct rq *rq, struct task_struct *p)
>  {
> -	int check_resched = 1;
> -
>  	/*
>  	 * If we are already running, then there's nothing
>  	 * that needs to be done. But if we are not running
>  	 * we may need to preempt the current running task.
> -	 * If that current running task is also an RT task
> -	 * then see if we can move to another run queue.
>  	 */
> -	if (p->on_rq && rq->curr != p) {
> -#ifdef CONFIG_SMP
> -		if (rq->rt.overloaded && push_rt_task(rq) &&
> -		    /* Don't resched if we changed runqueues */
> -		    rq != task_rq(p))
> -			check_resched = 0;
> -#endif /* CONFIG_SMP */
> -		if (check_resched && p->prio < rq->curr->prio)
> -			resched_task(rq->curr);
> -	}
> +	if (p->on_rq && rq->curr != p)
> +		check_preempt_curr_rt(rq, p, 0);


Note, although it works now, there's no guarantee that
check_preempt_curr_rt() will work with something other than an rt task
on the runqueue.

Also, this code removes the push_rt_task(rq) entirely, which means that
if we don't preempt current, and p is an RT task (as it is), we wont
push it off to another rq even if one is available for it to run on.

-- Steve


>  }
> 
>  /*
> @@ -1729,8 +1717,7 @@ prio_changed_rt(struct rq *rq, struct
> task_struct *p, int oldprio)
>  		 * greater than the current running task
>  		 * then reschedule.
>  		 */
> -		if (p->prio < rq->curr->prio)
> -			resched_task(rq->curr);
> +		check_preempt_curr_rt(rq, p, 0);
>  	}
>  }


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