Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1396576 > unrolled thread

[PATCH] sched/rt/deadline: Don't push if task's scheduling class was changed

Started byXunlei Pang <xlpang@redhat.com>
First post2016-05-09 06:20 +0200
Last post2016-05-10 10:50 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] sched/rt/deadline: Don't push if task's scheduling class was changed Xunlei Pang <xlpang@redhat.com> - 2016-05-09 06:20 +0200
    Re: [PATCH] sched/rt/deadline: Don't push if task's scheduling  class was changed Steven Rostedt <rostedt@goodmis.org> - 2016-05-09 17:30 +0200
    [tip:sched/urgent] sched/rt, sched/dl: Don't push if task's  scheduling class was changed tip-bot for Xunlei Pang <tipbot@zytor.com> - 2016-05-10 10:50 +0200

#1396576 — [PATCH] sched/rt/deadline: Don't push if task's scheduling class was changed

FromXunlei Pang <xlpang@redhat.com>
Date2016-05-09 06:20 +0200
Subject[PATCH] sched/rt/deadline: Don't push if task's scheduling class was changed
Message-ID<rwKPL-4Mr-3@gated-at.bofh.it>
We got a warning below:
    WARNING: CPU: 1 PID: 2468 at kernel/sched/core.c:1161 set_task_cpu+0x1af/0x1c0
    CPU: 1 PID: 2468 Comm: bugon Not tainted 4.6.0-rc3+ #16
    Hardware name: Intel Corporation Broadwell Client
    0000000000000086 0000000089618374 ffff8800897a7d50 ffffffff8133dc8c
    0000000000000000 0000000000000000 ffff8800897a7d90 ffffffff81089921
    0000048981037f39 ffff88016c4315c0 ffff88016ecd6e40 0000000000000000
    Call Trace:
    [<ffffffff8133dc8c>] dump_stack+0x63/0x87
    [<ffffffff81089921>] __warn+0xd1/0xf0
    [<ffffffff81089a5d>] warn_slowpath_null+0x1d/0x20
    [<ffffffff810b48ff>] set_task_cpu+0x1af/0x1c0
    [<ffffffff810cc90a>] push_dl_task.part.34+0xea/0x180
    [<ffffffff810ccd17>] push_dl_tasks+0x17/0x30
    [<ffffffff8118d17a>] __balance_callback+0x45/0x5c
    [<ffffffff810b2f46>] __sched_setscheduler+0x906/0xb90
    [<ffffffff810b6f50>] SyS_sched_setattr+0x150/0x190
    [<ffffffff81003c12>] do_syscall_64+0x62/0x110
    [<ffffffff816b5021>] entry_SYSCALL64_slow_path+0x25/0x25

The corresponding warning triggering code:
    WARN_ON_ONCE(p->state == TASK_RUNNING &&
             p->sched_class == &fair_sched_class &&
             (p->on_rq && !task_on_rq_migrating(p)))

This is because in find_lock_later_rq(), the task whose scheduling
class was changed to fair class is still pushed away as deadline.

So, check in find_lock_later_rq() after double_lock_balance(), if the
scheduling class of the deadline task was changed, break and retry.
Apply the same logic to RT.

Signed-off-by: Xunlei Pang <xlpang@redhat.com>
---
 kernel/sched/deadline.c | 1 +
 kernel/sched/rt.c       | 1 +
 2 files changed, 2 insertions(+)

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 169d40d..57eb3e4 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1385,6 +1385,7 @@ static struct rq *find_lock_later_rq(struct task_struct *task, struct rq *rq)
 				     !cpumask_test_cpu(later_rq->cpu,
 				                       &task->cpus_allowed) ||
 				     task_running(rq, task) ||
+				     !dl_task(task) ||
 				     !task_on_rq_queued(task))) {
 				double_unlock_balance(rq, later_rq);
 				later_rq = NULL;
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index ecfc83d..c10a6f5 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -1720,6 +1720,7 @@ static struct rq *find_lock_lowest_rq(struct task_struct *task, struct rq *rq)
 				     !cpumask_test_cpu(lowest_rq->cpu,
 						       tsk_cpus_allowed(task)) ||
 				     task_running(rq, task) ||
+				     !rt_task(task) ||
 				     !task_on_rq_queued(task))) {
 
 				double_unlock_balance(rq, lowest_rq);
-- 
1.8.3.1

[toc] | [next] | [standalone]


#1397146 — Re: [PATCH] sched/rt/deadline: Don't push if task's scheduling class was changed

FromSteven Rostedt <rostedt@goodmis.org>
Date2016-05-09 17:30 +0200
SubjectRe: [PATCH] sched/rt/deadline: Don't push if task's scheduling class was changed
Message-ID<rwVia-8if-13@gated-at.bofh.it>
In reply to#1396576
On Mon,  9 May 2016 12:11:31 +0800
Xunlei Pang <xlpang@redhat.com> wrote:

> We got a warning below:
>     WARNING: CPU: 1 PID: 2468 at kernel/sched/core.c:1161 set_task_cpu+0x1af/0x1c0
>     CPU: 1 PID: 2468 Comm: bugon Not tainted 4.6.0-rc3+ #16
>     Hardware name: Intel Corporation Broadwell Client
>     0000000000000086 0000000089618374 ffff8800897a7d50 ffffffff8133dc8c
>     0000000000000000 0000000000000000 ffff8800897a7d90 ffffffff81089921
>     0000048981037f39 ffff88016c4315c0 ffff88016ecd6e40 0000000000000000
>     Call Trace:
>     [<ffffffff8133dc8c>] dump_stack+0x63/0x87
>     [<ffffffff81089921>] __warn+0xd1/0xf0
>     [<ffffffff81089a5d>] warn_slowpath_null+0x1d/0x20
>     [<ffffffff810b48ff>] set_task_cpu+0x1af/0x1c0
>     [<ffffffff810cc90a>] push_dl_task.part.34+0xea/0x180
>     [<ffffffff810ccd17>] push_dl_tasks+0x17/0x30
>     [<ffffffff8118d17a>] __balance_callback+0x45/0x5c
>     [<ffffffff810b2f46>] __sched_setscheduler+0x906/0xb90
>     [<ffffffff810b6f50>] SyS_sched_setattr+0x150/0x190
>     [<ffffffff81003c12>] do_syscall_64+0x62/0x110
>     [<ffffffff816b5021>] entry_SYSCALL64_slow_path+0x25/0x25
> 
> The corresponding warning triggering code:
>     WARN_ON_ONCE(p->state == TASK_RUNNING &&
>              p->sched_class == &fair_sched_class &&
>              (p->on_rq && !task_on_rq_migrating(p)))
> 
> This is because in find_lock_later_rq(), the task whose scheduling
> class was changed to fair class is still pushed away as deadline.
> 
> So, check in find_lock_later_rq() after double_lock_balance(), if the
> scheduling class of the deadline task was changed, break and retry.
> Apply the same logic to RT.
> 
> Signed-off-by: Xunlei Pang <xlpang@redhat.com>

Reviewed-by: Steven Rostedt <rostedt@goodmis.org>

-- Steve


> ---
>  kernel/sched/deadline.c | 1 +
>  kernel/sched/rt.c       | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> index 169d40d..57eb3e4 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
> @@ -1385,6 +1385,7 @@ static struct rq *find_lock_later_rq(struct task_struct *task, struct rq *rq)
>  				     !cpumask_test_cpu(later_rq->cpu,
>  				                       &task->cpus_allowed) ||
>  				     task_running(rq, task) ||
> +				     !dl_task(task) ||
>  				     !task_on_rq_queued(task))) {
>  				double_unlock_balance(rq, later_rq);
>  				later_rq = NULL;
> diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
> index ecfc83d..c10a6f5 100644
> --- a/kernel/sched/rt.c
> +++ b/kernel/sched/rt.c
> @@ -1720,6 +1720,7 @@ static struct rq *find_lock_lowest_rq(struct task_struct *task, struct rq *rq)
>  				     !cpumask_test_cpu(lowest_rq->cpu,
>  						       tsk_cpus_allowed(task)) ||
>  				     task_running(rq, task) ||
> +				     !rt_task(task) ||
>  				     !task_on_rq_queued(task))) {
>  
>  				double_unlock_balance(rq, lowest_rq);

[toc] | [prev] | [next] | [standalone]


#1397865 — [tip:sched/urgent] sched/rt, sched/dl: Don't push if task's scheduling class was changed

Fromtip-bot for Xunlei Pang <tipbot@zytor.com>
Date2016-05-10 10:50 +0200
Subject[tip:sched/urgent] sched/rt, sched/dl: Don't push if task's scheduling class was changed
Message-ID<rxbwD-7k3-31@gated-at.bofh.it>
In reply to#1396576
Commit-ID:  13b5ab02ae118fc8dfdc2b8597688ec4a11d5b53
Gitweb:     http://git.kernel.org/tip/13b5ab02ae118fc8dfdc2b8597688ec4a11d5b53
Author:     Xunlei Pang <xlpang@redhat.com>
AuthorDate: Mon, 9 May 2016 12:11:31 +0800
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 10 May 2016 10:02:46 +0200

sched/rt, sched/dl: Don't push if task's scheduling class was changed

We got this warning:

    WARNING: CPU: 1 PID: 2468 at kernel/sched/core.c:1161 set_task_cpu+0x1af/0x1c0
    [...]
    Call Trace:

    dump_stack+0x63/0x87
    __warn+0xd1/0xf0
    warn_slowpath_null+0x1d/0x20
    set_task_cpu+0x1af/0x1c0
    push_dl_task.part.34+0xea/0x180
    push_dl_tasks+0x17/0x30
    __balance_callback+0x45/0x5c
    __sched_setscheduler+0x906/0xb90
    SyS_sched_setattr+0x150/0x190
    do_syscall_64+0x62/0x110
    entry_SYSCALL64_slow_path+0x25/0x25

This corresponds to:

    WARN_ON_ONCE(p->state == TASK_RUNNING &&
             p->sched_class == &fair_sched_class &&
             (p->on_rq && !task_on_rq_migrating(p)))

It happens because in find_lock_later_rq(), the task whose scheduling
class was changed to fair class is still pushed away as if it were
a deadline task ...

So, check in find_lock_later_rq() after double_lock_balance(), if the
scheduling class of the deadline task was changed, break and retry.

Apply the same logic to RT tasks.

Signed-off-by: Xunlei Pang <xlpang@redhat.com>
Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Juri Lelli <juri.lelli@arm.com>
Link: http://lkml.kernel.org/r/1462767091-1215-1-git-send-email-xlpang@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/sched/deadline.c | 1 +
 kernel/sched/rt.c       | 1 +
 2 files changed, 2 insertions(+)

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index affd97e..686ec8a 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1394,6 +1394,7 @@ static struct rq *find_lock_later_rq(struct task_struct *task, struct rq *rq)
 				     !cpumask_test_cpu(later_rq->cpu,
 				                       &task->cpus_allowed) ||
 				     task_running(rq, task) ||
+				     !dl_task(task) ||
 				     !task_on_rq_queued(task))) {
 				double_unlock_balance(rq, later_rq);
 				later_rq = NULL;
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index c41ea7a..ec4f538d 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -1729,6 +1729,7 @@ static struct rq *find_lock_lowest_rq(struct task_struct *task, struct rq *rq)
 				     !cpumask_test_cpu(lowest_rq->cpu,
 						       tsk_cpus_allowed(task)) ||
 				     task_running(rq, task) ||
+				     !rt_task(task) ||
 				     !task_on_rq_queued(task))) {
 
 				double_unlock_balance(rq, lowest_rq);

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web