linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 1/6] sched/rt: cleanup check preempt equal prio
@ 2014-10-30 22:39 Wanpeng Li
  2014-10-30 22:39 ` [PATCH v3 2/6] sched/deadline: fix artificial overrun introduced by yield_task_dl Wanpeng Li
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Wanpeng Li @ 2014-10-30 22:39 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra
  Cc: Juri Lelli, Kirill Tkhai, juri.lelli, linux-kernel, Wanpeng Li

This patch checks if current can be pushed/pulled somewhere else 
in advance to make logic clear, the same behavior as dl class.

- If current can't be migrated, useless to reschedule, let's hope 
  task can move out.
- If task is migratable, so let's not schedule it and see if it 
  can be pushed or pulled somewhere else.

Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
---
v2 -> v3:
 * cleanup subject/comments
 * align multi-line if() correctly

 kernel/sched/rt.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index d024e6c..a0b51aa 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -1351,16 +1351,22 @@ out:
 
 static void check_preempt_equal_prio(struct rq *rq, struct task_struct *p)
 {
-	if (rq->curr->nr_cpus_allowed == 1)
+	/*
+	 * Current can't be migrated, useless to reschedule,
+	 * let's hope p can move out.
+	 */
+	if (rq->curr->nr_cpus_allowed == 1 ||
+	    !cpupri_find(&rq->rd->cpupri, rq->curr, NULL))
 		return;
 
+	/*
+	 * p is migratable, so let's not schedule it and
+	 * see if it is pushed or pulled somewhere else.
+	 */
 	if (p->nr_cpus_allowed != 1
 	    && cpupri_find(&rq->rd->cpupri, p, NULL))
 		return;
 
-	if (!cpupri_find(&rq->rd->cpupri, rq->curr, NULL))
-		return;
-
 	/*
 	 * There appears to be other cpus that can accept
 	 * current and none to run 'p', so lets reschedule
-- 
1.9.1


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

* [PATCH v3 2/6] sched/deadline: fix artificial overrun introduced by yield_task_dl
  2014-10-30 22:39 [PATCH v3 1/6] sched/rt: cleanup check preempt equal prio Wanpeng Li
@ 2014-10-30 22:39 ` Wanpeng Li
  2014-11-04 16:11   ` [tip:sched/core] sched/deadline: Fix artificial overrun introduced by yield_task_dl() tip-bot for Wanpeng Li
  2014-10-30 22:39 ` [PATCH v3 3/6] sched/deadline: add deadline rq status print Wanpeng Li
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 12+ messages in thread
From: Wanpeng Li @ 2014-10-30 22:39 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra
  Cc: Juri Lelli, Kirill Tkhai, juri.lelli, linux-kernel, Wanpeng Li

The yield semantic of deadline class is to reduce remaining runtime to 
zero, and then update_curr_dl() will stop it. However, comsumed bandwidth 
is reduced from the budget of yield task again even if it has already been 
set to zero which leads to artificial overrun. This patch fix it by make 
sure we don't steal some more time from the task that yielded in update_curr_dl().

Suggested-by: Juri Lelli <juri.lelli@arm.com>
Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
---
v1 -> v2:
 * make sure we don't steal some more time from the task 
   that yielded in update_curr_dl().

 kernel/sched/deadline.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 2e31a30..db6ad38 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -633,7 +633,7 @@ static void update_curr_dl(struct rq *rq)
 
 	sched_rt_avg_update(rq, delta_exec);
 
-	dl_se->runtime -= delta_exec;
+	dl_se->runtime -= dl_se->dl_yielded ? 0 : delta_exec;
 	if (dl_runtime_exceeded(rq, dl_se)) {
 		__dequeue_task_dl(rq, curr, 0);
 		if (likely(start_dl_timer(dl_se, curr->dl.dl_boosted)))
-- 
1.9.1


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

* [PATCH v3 3/6] sched/deadline: add deadline rq status print
  2014-10-30 22:39 [PATCH v3 1/6] sched/rt: cleanup check preempt equal prio Wanpeng Li
  2014-10-30 22:39 ` [PATCH v3 2/6] sched/deadline: fix artificial overrun introduced by yield_task_dl Wanpeng Li
@ 2014-10-30 22:39 ` Wanpeng Li
  2014-11-04 16:11   ` [tip:sched/core] sched/deadline: Add " tip-bot for Wanpeng Li
  2014-10-30 22:39 ` [PATCH v3 4/6] sched/deadline: push task away if the deadline is equal to curr during wakeup Wanpeng Li
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 12+ messages in thread
From: Wanpeng Li @ 2014-10-30 22:39 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra
  Cc: Juri Lelli, Kirill Tkhai, juri.lelli, linux-kernel, Wanpeng Li

This patch add deadline rq status print.

Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
---
 kernel/sched/deadline.c | 9 +++++++++
 kernel/sched/debug.c    | 7 +++++++
 kernel/sched/sched.h    | 1 +
 3 files changed, 17 insertions(+)

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index db6ad38..4c5fdf5 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1727,3 +1727,12 @@ const struct sched_class dl_sched_class = {
 	.switched_from		= switched_from_dl,
 	.switched_to		= switched_to_dl,
 };
+
+#ifdef CONFIG_SCHED_DEBUG
+extern void print_dl_rq(struct seq_file *m, int cpu, struct dl_rq *dl_rq);
+
+void print_dl_stats(struct seq_file *m, int cpu)
+{
+	print_dl_rq(m, cpu, &cpu_rq(cpu)->dl);
+}
+#endif /* CONFIG_SCHED_DEBUG */
diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
index ce33780..eeb6046 100644
--- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c
@@ -261,6 +261,12 @@ void print_rt_rq(struct seq_file *m, int cpu, struct rt_rq *rt_rq)
 #undef P
 }
 
+void print_dl_rq(struct seq_file *m, int cpu, struct dl_rq *dl_rq)
+{
+	SEQ_printf(m, "\ndl_rq[%d]:\n", cpu);
+	SEQ_printf(m, "  .%-30s: %ld\n", "dl_nr_running", dl_rq->dl_nr_running);
+}
+
 extern __read_mostly int sched_clock_running;
 
 static void print_cpu(struct seq_file *m, int cpu)
@@ -329,6 +335,7 @@ do {									\
 	spin_lock_irqsave(&sched_debug_lock, flags);
 	print_cfs_stats(m, cpu);
 	print_rt_stats(m, cpu);
+	print_dl_stats(m, cpu);
 
 	print_rq(m, rq, cpu);
 	spin_unlock_irqrestore(&sched_debug_lock, flags);
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index ec3917c..3c6cac6 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -1532,6 +1532,7 @@ extern struct sched_entity *__pick_first_entity(struct cfs_rq *cfs_rq);
 extern struct sched_entity *__pick_last_entity(struct cfs_rq *cfs_rq);
 extern void print_cfs_stats(struct seq_file *m, int cpu);
 extern void print_rt_stats(struct seq_file *m, int cpu);
+extern void print_dl_stats(struct seq_file *m, int cpu);
 
 extern void init_cfs_rq(struct cfs_rq *cfs_rq);
 extern void init_rt_rq(struct rt_rq *rt_rq, struct rq *rq);
-- 
1.9.1


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

* [PATCH v3 4/6] sched/deadline: push task away if the deadline is equal to curr during wakeup
  2014-10-30 22:39 [PATCH v3 1/6] sched/rt: cleanup check preempt equal prio Wanpeng Li
  2014-10-30 22:39 ` [PATCH v3 2/6] sched/deadline: fix artificial overrun introduced by yield_task_dl Wanpeng Li
  2014-10-30 22:39 ` [PATCH v3 3/6] sched/deadline: add deadline rq status print Wanpeng Li
@ 2014-10-30 22:39 ` Wanpeng Li
  2014-11-04 16:11   ` [tip:sched/core] sched/deadline: Push " tip-bot for Wanpeng Li
  2014-10-30 22:39 ` [PATCH v3 5/6] sched/deadline: reschedule from switched_from_dl() after a successful pull Wanpeng Li
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 12+ messages in thread
From: Wanpeng Li @ 2014-10-30 22:39 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra
  Cc: Juri Lelli, Kirill Tkhai, juri.lelli, linux-kernel, Wanpeng Li

This patch pushes task away if the dealine of the task is equal 
to current during wake up. The same behavior as rt class.

Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
---
 kernel/sched/deadline.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 4c5fdf5..1c09751 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1511,7 +1511,7 @@ static void task_woken_dl(struct rq *rq, struct task_struct *p)
 	    p->nr_cpus_allowed > 1 &&
 	    dl_task(rq->curr) &&
 	    (rq->curr->nr_cpus_allowed < 2 ||
-	     dl_entity_preempt(&rq->curr->dl, &p->dl))) {
+	     !dl_entity_preempt(&p->dl, &rq->curr->dl))) {
 		push_dl_tasks(rq);
 	}
 }
-- 
1.9.1


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

* [PATCH v3 5/6] sched/deadline: reschedule from switched_from_dl() after a successful pull
  2014-10-30 22:39 [PATCH v3 1/6] sched/rt: cleanup check preempt equal prio Wanpeng Li
                   ` (2 preceding siblings ...)
  2014-10-30 22:39 ` [PATCH v3 4/6] sched/deadline: push task away if the deadline is equal to curr during wakeup Wanpeng Li
@ 2014-10-30 22:39 ` Wanpeng Li
  2014-11-04 16:11   ` [tip:sched/core] sched/deadline: Reschedule from switched_from_dl () " tip-bot for Wanpeng Li
  2014-10-30 22:39 ` [PATCH v3 6/6] sched/deadline: don't check CONFIG_SMP in switched_from_dl Wanpeng Li
  2014-11-04 16:10 ` [tip:sched/core] sched/rt: Clean up check_preempt_equal_prio() tip-bot for Wanpeng Li
  5 siblings, 1 reply; 12+ messages in thread
From: Wanpeng Li @ 2014-10-30 22:39 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra
  Cc: Juri Lelli, Kirill Tkhai, juri.lelli, linux-kernel, Wanpeng Li

In switched_from_dl() we have to issue a resched if we successfully 
pulled some task from other cpus. This patch also aligns the behavior 
with -rt.

Suggested-by: Juri Lelli <juri.lelli@arm.com>
Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
---
v1 -> v2:
 * align the behaviour with -rt.

 kernel/sched/deadline.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 1c09751..2b23d50 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1623,8 +1623,11 @@ static void switched_from_dl(struct rq *rq, struct task_struct *p)
 	 * this is the right place to try to pull some other one
 	 * from an overloaded cpu, if any.
 	 */
-	if (!rq->dl.dl_nr_running)
-		pull_dl_task(rq);
+	if (!task_on_rq_queued(p) || rq->dl.dl_nr_running)
+		return;
+
+	if (pull_dl_task(rq))
+		resched_curr(rq);
 #endif
 }
 
-- 
1.9.1


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

* [PATCH v3 6/6] sched/deadline: don't check CONFIG_SMP in switched_from_dl
  2014-10-30 22:39 [PATCH v3 1/6] sched/rt: cleanup check preempt equal prio Wanpeng Li
                   ` (3 preceding siblings ...)
  2014-10-30 22:39 ` [PATCH v3 5/6] sched/deadline: reschedule from switched_from_dl() after a successful pull Wanpeng Li
@ 2014-10-30 22:39 ` Wanpeng Li
  2014-11-04 16:12   ` [tip:sched/core] sched/deadline: Don' t check CONFIG_SMP in switched_from_dl() tip-bot for Wanpeng Li
  2014-11-04 16:10 ` [tip:sched/core] sched/rt: Clean up check_preempt_equal_prio() tip-bot for Wanpeng Li
  5 siblings, 1 reply; 12+ messages in thread
From: Wanpeng Li @ 2014-10-30 22:39 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra
  Cc: Juri Lelli, Kirill Tkhai, juri.lelli, linux-kernel, Wanpeng Li

There are both UP and SMP version of pull_dl_task(), so don't need 
to check CONFIG_SMP in switched_from_dl();

Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
---
 kernel/sched/deadline.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 2b23d50..c262eeb 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1617,7 +1617,6 @@ static void switched_from_dl(struct rq *rq, struct task_struct *p)
 
 	__dl_clear_params(p);
 
-#ifdef CONFIG_SMP
 	/*
 	 * Since this might be the only -deadline task on the rq,
 	 * this is the right place to try to pull some other one
@@ -1628,7 +1627,6 @@ static void switched_from_dl(struct rq *rq, struct task_struct *p)
 
 	if (pull_dl_task(rq))
 		resched_curr(rq);
-#endif
 }
 
 /*
-- 
1.9.1


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

* [tip:sched/core] sched/rt: Clean up check_preempt_equal_prio()
  2014-10-30 22:39 [PATCH v3 1/6] sched/rt: cleanup check preempt equal prio Wanpeng Li
                   ` (4 preceding siblings ...)
  2014-10-30 22:39 ` [PATCH v3 6/6] sched/deadline: don't check CONFIG_SMP in switched_from_dl Wanpeng Li
@ 2014-11-04 16:10 ` tip-bot for Wanpeng Li
  5 siblings, 0 replies; 12+ messages in thread
From: tip-bot for Wanpeng Li @ 2014-11-04 16:10 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: ktkhai, juri.lelli, tglx, rostedt, mingo, wanpeng.li, torvalds,
	linux-kernel, peterz, hpa

Commit-ID:  308a623a40ce168eb234ea82c2bd13ff85a098d9
Gitweb:     http://git.kernel.org/tip/308a623a40ce168eb234ea82c2bd13ff85a098d9
Author:     Wanpeng Li <wanpeng.li@linux.intel.com>
AuthorDate: Fri, 31 Oct 2014 06:39:31 +0800
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 4 Nov 2014 07:17:52 +0100

sched/rt: Clean up check_preempt_equal_prio()

This patch checks if current can be pushed/pulled somewhere else
in advance to make logic clear, the same behavior as dl class.

- If current can't be migrated, useless to reschedule, let's hope
  task can move out.
- If task is migratable, so let's not schedule it and see if it
  can be pushed or pulled somewhere else.

Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Juri Lelli <juri.lelli@arm.com>
Cc: Kirill Tkhai <ktkhai@parallels.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/1414708776-124078-1-git-send-email-wanpeng.li@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/sched/rt.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index d024e6c..3d14312 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -1351,16 +1351,22 @@ out:
 
 static void check_preempt_equal_prio(struct rq *rq, struct task_struct *p)
 {
-	if (rq->curr->nr_cpus_allowed == 1)
+	/*
+	 * Current can't be migrated, useless to reschedule,
+	 * let's hope p can move out.
+	 */
+	if (rq->curr->nr_cpus_allowed == 1 ||
+	    !cpupri_find(&rq->rd->cpupri, rq->curr, NULL))
 		return;
 
+	/*
+	 * p is migratable, so let's not schedule it and
+	 * see if it is pushed or pulled somewhere else.
+	 */
 	if (p->nr_cpus_allowed != 1
 	    && cpupri_find(&rq->rd->cpupri, p, NULL))
 		return;
 
-	if (!cpupri_find(&rq->rd->cpupri, rq->curr, NULL))
-		return;
-
 	/*
 	 * There appears to be other cpus that can accept
 	 * current and none to run 'p', so lets reschedule

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

* [tip:sched/core] sched/deadline: Fix artificial overrun introduced by yield_task_dl()
  2014-10-30 22:39 ` [PATCH v3 2/6] sched/deadline: fix artificial overrun introduced by yield_task_dl Wanpeng Li
@ 2014-11-04 16:11   ` tip-bot for Wanpeng Li
  0 siblings, 0 replies; 12+ messages in thread
From: tip-bot for Wanpeng Li @ 2014-11-04 16:11 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: ktkhai, juri.lelli, tglx, wanpeng.li, torvalds, mingo, hpa,
	linux-kernel, peterz

Commit-ID:  804968809c321066cca028d4cbd533a420f964bc
Gitweb:     http://git.kernel.org/tip/804968809c321066cca028d4cbd533a420f964bc
Author:     Wanpeng Li <wanpeng.li@linux.intel.com>
AuthorDate: Fri, 31 Oct 2014 06:39:32 +0800
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 4 Nov 2014 07:17:53 +0100

sched/deadline: Fix artificial overrun introduced by yield_task_dl()

The yield semantic of deadline class is to reduce remaining runtime to
zero, and then update_curr_dl() will stop it. However, comsumed bandwidth
is reduced from the budget of yield task again even if it has already been
set to zero which leads to artificial overrun. This patch fix it by make
sure we don't steal some more time from the task that yielded in update_curr_dl().

Suggested-by: Juri Lelli <juri.lelli@arm.com>
Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Kirill Tkhai <ktkhai@parallels.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/1414708776-124078-2-git-send-email-wanpeng.li@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/sched/deadline.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 9d483e8..c047a94 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -628,7 +628,7 @@ static void update_curr_dl(struct rq *rq)
 
 	sched_rt_avg_update(rq, delta_exec);
 
-	dl_se->runtime -= delta_exec;
+	dl_se->runtime -= dl_se->dl_yielded ? 0 : delta_exec;
 	if (dl_runtime_exceeded(rq, dl_se)) {
 		__dequeue_task_dl(rq, curr, 0);
 		if (likely(start_dl_timer(dl_se, curr->dl.dl_boosted)))

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

* [tip:sched/core] sched/deadline: Add deadline rq status print
  2014-10-30 22:39 ` [PATCH v3 3/6] sched/deadline: add deadline rq status print Wanpeng Li
@ 2014-11-04 16:11   ` tip-bot for Wanpeng Li
  0 siblings, 0 replies; 12+ messages in thread
From: tip-bot for Wanpeng Li @ 2014-11-04 16:11 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: juri.lelli, hpa, linux-kernel, torvalds, mingo, tglx, ktkhai,
	peterz, wanpeng.li

Commit-ID:  acb32132ec0433c03bed750f3e9508dc29db0328
Gitweb:     http://git.kernel.org/tip/acb32132ec0433c03bed750f3e9508dc29db0328
Author:     Wanpeng Li <wanpeng.li@linux.intel.com>
AuthorDate: Fri, 31 Oct 2014 06:39:33 +0800
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 4 Nov 2014 07:17:54 +0100

sched/deadline: Add deadline rq status print

This patch add deadline rq status print.

Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Juri Lelli <juri.lelli@arm.com>
Cc: Kirill Tkhai <ktkhai@parallels.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/1414708776-124078-3-git-send-email-wanpeng.li@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/sched/deadline.c | 9 +++++++++
 kernel/sched/debug.c    | 7 +++++++
 kernel/sched/sched.h    | 1 +
 3 files changed, 17 insertions(+)

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index c047a94..8867a67 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1747,3 +1747,12 @@ const struct sched_class dl_sched_class = {
 	.switched_from		= switched_from_dl,
 	.switched_to		= switched_to_dl,
 };
+
+#ifdef CONFIG_SCHED_DEBUG
+extern void print_dl_rq(struct seq_file *m, int cpu, struct dl_rq *dl_rq);
+
+void print_dl_stats(struct seq_file *m, int cpu)
+{
+	print_dl_rq(m, cpu, &cpu_rq(cpu)->dl);
+}
+#endif /* CONFIG_SCHED_DEBUG */
diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
index ce33780..eeb6046 100644
--- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c
@@ -261,6 +261,12 @@ void print_rt_rq(struct seq_file *m, int cpu, struct rt_rq *rt_rq)
 #undef P
 }
 
+void print_dl_rq(struct seq_file *m, int cpu, struct dl_rq *dl_rq)
+{
+	SEQ_printf(m, "\ndl_rq[%d]:\n", cpu);
+	SEQ_printf(m, "  .%-30s: %ld\n", "dl_nr_running", dl_rq->dl_nr_running);
+}
+
 extern __read_mostly int sched_clock_running;
 
 static void print_cpu(struct seq_file *m, int cpu)
@@ -329,6 +335,7 @@ do {									\
 	spin_lock_irqsave(&sched_debug_lock, flags);
 	print_cfs_stats(m, cpu);
 	print_rt_stats(m, cpu);
+	print_dl_stats(m, cpu);
 
 	print_rq(m, rq, cpu);
 	spin_unlock_irqrestore(&sched_debug_lock, flags);
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 49b941f..7e5c1ee 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -1537,6 +1537,7 @@ extern struct sched_entity *__pick_first_entity(struct cfs_rq *cfs_rq);
 extern struct sched_entity *__pick_last_entity(struct cfs_rq *cfs_rq);
 extern void print_cfs_stats(struct seq_file *m, int cpu);
 extern void print_rt_stats(struct seq_file *m, int cpu);
+extern void print_dl_stats(struct seq_file *m, int cpu);
 
 extern void init_cfs_rq(struct cfs_rq *cfs_rq);
 extern void init_rt_rq(struct rt_rq *rt_rq, struct rq *rq);

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

* [tip:sched/core] sched/deadline: Push task away if the deadline is equal to curr during wakeup
  2014-10-30 22:39 ` [PATCH v3 4/6] sched/deadline: push task away if the deadline is equal to curr during wakeup Wanpeng Li
@ 2014-11-04 16:11   ` tip-bot for Wanpeng Li
  0 siblings, 0 replies; 12+ messages in thread
From: tip-bot for Wanpeng Li @ 2014-11-04 16:11 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: torvalds, hpa, ktkhai, wanpeng.li, tglx, peterz, juri.lelli,
	mingo, linux-kernel

Commit-ID:  6b0a563f3a534827c1b56e53c3fd0fccec3c7895
Gitweb:     http://git.kernel.org/tip/6b0a563f3a534827c1b56e53c3fd0fccec3c7895
Author:     Wanpeng Li <wanpeng.li@linux.intel.com>
AuthorDate: Fri, 31 Oct 2014 06:39:34 +0800
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 4 Nov 2014 07:17:55 +0100

sched/deadline: Push task away if the deadline is equal to curr during wakeup

This patch pushes task away if the dealine of the task is equal
to current during wake up. The same behavior as rt class.

Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Juri Lelli <juri.lelli@arm.com>
Cc: Kirill Tkhai <ktkhai@parallels.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/1414708776-124078-4-git-send-email-wanpeng.li@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/sched/deadline.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 8867a67..e7779b3 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1506,7 +1506,7 @@ static void task_woken_dl(struct rq *rq, struct task_struct *p)
 	    p->nr_cpus_allowed > 1 &&
 	    dl_task(rq->curr) &&
 	    (rq->curr->nr_cpus_allowed < 2 ||
-	     dl_entity_preempt(&rq->curr->dl, &p->dl))) {
+	     !dl_entity_preempt(&p->dl, &rq->curr->dl))) {
 		push_dl_tasks(rq);
 	}
 }

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

* [tip:sched/core] sched/deadline: Reschedule from switched_from_dl () after a successful pull
  2014-10-30 22:39 ` [PATCH v3 5/6] sched/deadline: reschedule from switched_from_dl() after a successful pull Wanpeng Li
@ 2014-11-04 16:11   ` tip-bot for Wanpeng Li
  0 siblings, 0 replies; 12+ messages in thread
From: tip-bot for Wanpeng Li @ 2014-11-04 16:11 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, ktkhai, torvalds, mingo, peterz, tglx, juri.lelli,
	hpa, wanpeng.li

Commit-ID:  cd66091162d34f589631a23bbe0ed214798245b4
Gitweb:     http://git.kernel.org/tip/cd66091162d34f589631a23bbe0ed214798245b4
Author:     Wanpeng Li <wanpeng.li@linux.intel.com>
AuthorDate: Fri, 31 Oct 2014 06:39:35 +0800
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 4 Nov 2014 07:17:55 +0100

sched/deadline: Reschedule from switched_from_dl() after a successful pull

In switched_from_dl() we have to issue a resched if we successfully
pulled some task from other cpus. This patch also aligns the behavior
with -rt.

Suggested-by: Juri Lelli <juri.lelli@arm.com>
Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Kirill Tkhai <ktkhai@parallels.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/1414708776-124078-5-git-send-email-wanpeng.li@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/sched/deadline.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index e7779b3..362ab1f 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1643,8 +1643,11 @@ static void switched_from_dl(struct rq *rq, struct task_struct *p)
 	 * this is the right place to try to pull some other one
 	 * from an overloaded cpu, if any.
 	 */
-	if (!rq->dl.dl_nr_running)
-		pull_dl_task(rq);
+	if (!task_on_rq_queued(p) || rq->dl.dl_nr_running)
+		return;
+
+	if (pull_dl_task(rq))
+		resched_curr(rq);
 #endif
 }
 

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

* [tip:sched/core] sched/deadline: Don' t check CONFIG_SMP in switched_from_dl()
  2014-10-30 22:39 ` [PATCH v3 6/6] sched/deadline: don't check CONFIG_SMP in switched_from_dl Wanpeng Li
@ 2014-11-04 16:12   ` tip-bot for Wanpeng Li
  0 siblings, 0 replies; 12+ messages in thread
From: tip-bot for Wanpeng Li @ 2014-11-04 16:12 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: tglx, wanpeng.li, torvalds, linux-kernel, peterz, mingo, ktkhai,
	juri.lelli, hpa

Commit-ID:  cad3bb32e181c286c46ec12b2deb1f26a6f9835d
Gitweb:     http://git.kernel.org/tip/cad3bb32e181c286c46ec12b2deb1f26a6f9835d
Author:     Wanpeng Li <wanpeng.li@linux.intel.com>
AuthorDate: Fri, 31 Oct 2014 06:39:36 +0800
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 4 Nov 2014 07:17:56 +0100

sched/deadline: Don't check CONFIG_SMP in switched_from_dl()

There are both UP and SMP version of pull_dl_task(), so don't need
to check CONFIG_SMP in switched_from_dl();

Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Juri Lelli <juri.lelli@arm.com>
Cc: Kirill Tkhai <ktkhai@parallels.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/1414708776-124078-6-git-send-email-wanpeng.li@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/sched/deadline.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 362ab1f..f3d7776 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1637,7 +1637,6 @@ static void switched_from_dl(struct rq *rq, struct task_struct *p)
 
 	__dl_clear_params(p);
 
-#ifdef CONFIG_SMP
 	/*
 	 * Since this might be the only -deadline task on the rq,
 	 * this is the right place to try to pull some other one
@@ -1648,7 +1647,6 @@ static void switched_from_dl(struct rq *rq, struct task_struct *p)
 
 	if (pull_dl_task(rq))
 		resched_curr(rq);
-#endif
 }
 
 /*

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

end of thread, other threads:[~2014-11-04 16:13 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-30 22:39 [PATCH v3 1/6] sched/rt: cleanup check preempt equal prio Wanpeng Li
2014-10-30 22:39 ` [PATCH v3 2/6] sched/deadline: fix artificial overrun introduced by yield_task_dl Wanpeng Li
2014-11-04 16:11   ` [tip:sched/core] sched/deadline: Fix artificial overrun introduced by yield_task_dl() tip-bot for Wanpeng Li
2014-10-30 22:39 ` [PATCH v3 3/6] sched/deadline: add deadline rq status print Wanpeng Li
2014-11-04 16:11   ` [tip:sched/core] sched/deadline: Add " tip-bot for Wanpeng Li
2014-10-30 22:39 ` [PATCH v3 4/6] sched/deadline: push task away if the deadline is equal to curr during wakeup Wanpeng Li
2014-11-04 16:11   ` [tip:sched/core] sched/deadline: Push " tip-bot for Wanpeng Li
2014-10-30 22:39 ` [PATCH v3 5/6] sched/deadline: reschedule from switched_from_dl() after a successful pull Wanpeng Li
2014-11-04 16:11   ` [tip:sched/core] sched/deadline: Reschedule from switched_from_dl () " tip-bot for Wanpeng Li
2014-10-30 22:39 ` [PATCH v3 6/6] sched/deadline: don't check CONFIG_SMP in switched_from_dl Wanpeng Li
2014-11-04 16:12   ` [tip:sched/core] sched/deadline: Don' t check CONFIG_SMP in switched_from_dl() tip-bot for Wanpeng Li
2014-11-04 16:10 ` [tip:sched/core] sched/rt: Clean up check_preempt_equal_prio() tip-bot for Wanpeng Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).