public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 1/6] sched/fair: check_preempt_wakeup: Fix assumption on the default policy
@ 2016-09-16 21:09 Julien Desfossez
  2016-09-16 21:09 ` [RFC PATCH 2/6] sched: get effective policy and rt_prio Julien Desfossez
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Julien Desfossez @ 2016-09-16 21:09 UTC (permalink / raw)
  To: peterz, tglx, rostedt, mingo, daolivei
  Cc: mathieu.desnoyers, linux-kernel, Julien Desfossez

Tasks with RT or deadline scheduling class may inherit from a task with
a "fair" scheduling class. This priority inheritance changes the
scheduling class, but not the task "policy" field.

Therefore, the fair scheduler should not assume that policy !=
SCHED_NORMAL is the same as (policy == SCHED_BATCH || policy ==
SCHED_IDLE), because the policy could also be SCHED_RR, SCHED_FIFO, or
SCHED_DEADLINE.

The incorrect comparison in check_preempt_wakeup makes RR, FIFO and
DEADLINE tasks which inherit from a fair task behave as if they were
IDLE or BATCH tasks, thus awaiting the following tick before preempting
the current task.

Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt (Red Hat) <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
---
 kernel/sched/fair.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 07aaa7f..f3aef21 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -5669,7 +5669,8 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_
 	 * Batch and idle tasks do not preempt non-idle tasks (their preemption
 	 * is driven by the tick):
 	 */
-	if (unlikely(p->policy != SCHED_NORMAL) || !sched_feat(WAKEUP_PREEMPTION))
+	if (unlikely(p->policy == SCHED_BATCH || p->policy == SCHED_IDLE) ||
+			!sched_feat(WAKEUP_PREEMPTION))
 		return;
 
 	find_matching_se(&se, &pse);
-- 
1.9.1

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

end of thread, other threads:[~2016-09-21  0:09 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-16 21:09 [RFC PATCH 1/6] sched/fair: check_preempt_wakeup: Fix assumption on the default policy Julien Desfossez
2016-09-16 21:09 ` [RFC PATCH 2/6] sched: get effective policy and rt_prio Julien Desfossez
2016-09-16 21:09 ` [RFC PATCH 3/6] tracing: add sched_update_prio Julien Desfossez
2016-09-16 21:09 ` [RFC PATCH 4/6] tracing: add TRACE_EVENT_MAP Julien Desfossez
2016-09-16 21:09 ` [RFC PATCH 5/6] tracing: extend scheduling tracepoints Julien Desfossez
2016-09-16 21:09 ` [RFC PATCH 6/6] tracing: extend sched_pi_setprio Julien Desfossez
2016-09-20 20:49 ` [RFC PATCH 1/6] sched/fair: check_preempt_wakeup: Fix assumption on the default policy Thomas Gleixner
2016-09-20 22:04   ` Mathieu Desnoyers
2016-09-20 22:56     ` Thomas Gleixner
2016-09-21  0:09       ` Julien Desfossez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox