All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/2] sched/deadline: don't need to check throttled status when switched to dl
@ 2015-03-17 11:15 Wanpeng Li
  2015-03-17 11:15 ` [PATCH v3 2/2] sched/deadline: fix rt runtime corrupt when dl refuse a smaller bandwidth Wanpeng Li
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Wanpeng Li @ 2015-03-17 11:15 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra; +Cc: Juri Lelli, linux-kernel, Wanpeng Li

After commit 40767b0dc768 ("sched/deadline: Fix deadline parameter
modification handling") is merged, deadline task throttled status 
is cleared each time once switch from dl class, so throttled status 
always doesn't set when switch back, there is no need to check 
throttled status, this patch drop the check.

Acked-by: Juri Lelli <juri.lelli@arm.com>
Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
---
v2 -> v3:
 * update changelog

 kernel/sched/deadline.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 27b9381..eed6529 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1722,14 +1722,6 @@ static void switched_to_dl(struct rq *rq, struct task_struct *p)
 {
 	int check_resched = 1;
 
-	/*
-	 * If p is throttled, don't consider the possibility
-	 * of preempting rq->curr, the check will be done right
-	 * after its runtime will get replenished.
-	 */
-	if (unlikely(p->dl.dl_throttled))
-		return;
-
 	if (task_on_rq_queued(p) && rq->curr != p) {
 #ifdef CONFIG_SMP
 		if (p->nr_cpus_allowed > 1 && rq->dl.overloaded &&
-- 
1.9.1


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

* [PATCH v3 2/2] sched/deadline: fix rt runtime corrupt when dl refuse a smaller bandwidth
  2015-03-17 11:15 [PATCH v3 1/2] sched/deadline: don't need to check throttled status when switched to dl Wanpeng Li
@ 2015-03-17 11:15 ` Wanpeng Li
  2015-03-27 11:44   ` [tip:sched/core] sched/deadline: Fix rt runtime corruption when dl fails its global constraints tip-bot for Wanpeng Li
  2015-03-19  4:20 ` [PATCH v3 1/2] sched/deadline: don't need to check throttled status when switched to dl Wanpeng Li
  2015-03-27 11:43 ` [tip:sched/core] sched/deadline: Avoid a superfluous check tip-bot for Wanpeng Li
  2 siblings, 1 reply; 5+ messages in thread
From: Wanpeng Li @ 2015-03-17 11:15 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra; +Cc: Juri Lelli, linux-kernel, Wanpeng Li

Dl class will refuse the bandwidth to be set to some value smaller
than the current allocated bandwidth in any of the root_domains
through sched_rt_runtime_us and sched_rt_period_us. RT runtime will
be set according to sched_rt_runtime_us before dl class verify if
the new bandwidth is suitable in the case of !CONFIG_RT_GROUP_SCHED.

However, rt runtime will be corrupted if dl refuse the new bandwidth
since there is no undo to reset the rt runtime to the old value.

This patch fix it by verifying new bandwidth for deadline in advance.

Acked-by: Juri Lelli <juri.lelli@arm.com>
Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
---
v2 -> v3:
 * update changelog

 kernel/sched/core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 97fe79c..e884909 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -7815,7 +7815,7 @@ static int sched_rt_global_constraints(void)
 }
 #endif /* CONFIG_RT_GROUP_SCHED */
 
-static int sched_dl_global_constraints(void)
+static int sched_dl_global_validate(void)
 {
 	u64 runtime = global_rt_runtime();
 	u64 period = global_rt_period();
@@ -7916,11 +7916,11 @@ int sched_rt_handler(struct ctl_table *table, int write,
 		if (ret)
 			goto undo;
 
-		ret = sched_rt_global_constraints();
+		ret = sched_dl_global_validate();
 		if (ret)
 			goto undo;
 
-		ret = sched_dl_global_constraints();
+		ret = sched_rt_global_constraints();
 		if (ret)
 			goto undo;
 
-- 
1.9.1


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

* Re: [PATCH v3 1/2] sched/deadline: don't need to check throttled status when switched to dl
  2015-03-17 11:15 [PATCH v3 1/2] sched/deadline: don't need to check throttled status when switched to dl Wanpeng Li
  2015-03-17 11:15 ` [PATCH v3 2/2] sched/deadline: fix rt runtime corrupt when dl refuse a smaller bandwidth Wanpeng Li
@ 2015-03-19  4:20 ` Wanpeng Li
  2015-03-27 11:43 ` [tip:sched/core] sched/deadline: Avoid a superfluous check tip-bot for Wanpeng Li
  2 siblings, 0 replies; 5+ messages in thread
From: Wanpeng Li @ 2015-03-19  4:20 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Peter Zijlstra, Juri Lelli, linux-kernel, Wanpeng Li

Hi Ingo, how about these three patches this time, sorry for my bad english.
On Tue, Mar 17, 2015 at 07:15:30PM +0800, Wanpeng Li wrote:
>After commit 40767b0dc768 ("sched/deadline: Fix deadline parameter
>modification handling") is merged, deadline task throttled status 
>is cleared each time once switch from dl class, so throttled status 
>always doesn't set when switch back, there is no need to check 
>throttled status, this patch drop the check.
>
>Acked-by: Juri Lelli <juri.lelli@arm.com>
>Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
>---
>v2 -> v3:
> * update changelog
>
> kernel/sched/deadline.c | 8 --------
> 1 file changed, 8 deletions(-)
>
>diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
>index 27b9381..eed6529 100644
>--- a/kernel/sched/deadline.c
>+++ b/kernel/sched/deadline.c
>@@ -1722,14 +1722,6 @@ static void switched_to_dl(struct rq *rq, struct task_struct *p)
> {
> 	int check_resched = 1;
> 
>-	/*
>-	 * If p is throttled, don't consider the possibility
>-	 * of preempting rq->curr, the check will be done right
>-	 * after its runtime will get replenished.
>-	 */
>-	if (unlikely(p->dl.dl_throttled))
>-		return;
>-
> 	if (task_on_rq_queued(p) && rq->curr != p) {
> #ifdef CONFIG_SMP
> 		if (p->nr_cpus_allowed > 1 && rq->dl.overloaded &&
>-- 
>1.9.1

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

* [tip:sched/core] sched/deadline: Avoid a superfluous check
  2015-03-17 11:15 [PATCH v3 1/2] sched/deadline: don't need to check throttled status when switched to dl Wanpeng Li
  2015-03-17 11:15 ` [PATCH v3 2/2] sched/deadline: fix rt runtime corrupt when dl refuse a smaller bandwidth Wanpeng Li
  2015-03-19  4:20 ` [PATCH v3 1/2] sched/deadline: don't need to check throttled status when switched to dl Wanpeng Li
@ 2015-03-27 11:43 ` tip-bot for Wanpeng Li
  2 siblings, 0 replies; 5+ messages in thread
From: tip-bot for Wanpeng Li @ 2015-03-27 11:43 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, juri.lelli, wanpeng.li, peterz, mingo, hpa, tglx

Commit-ID:  bd4bde14b93cce8fa77765ff709e0be55abdba2c
Gitweb:     http://git.kernel.org/tip/bd4bde14b93cce8fa77765ff709e0be55abdba2c
Author:     Wanpeng Li <wanpeng.li@linux.intel.com>
AuthorDate: Tue, 17 Mar 2015 19:15:30 +0800
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Fri, 27 Mar 2015 09:36:12 +0100

sched/deadline: Avoid a superfluous check

Since commit 40767b0dc768 ("sched/deadline: Fix deadline parameter
modification handling") we clear the thottled state when switching
from a dl task, therefore we should never find it set in switching to
a dl task.

Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
[ Improved the changelog. ]
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Juri Lelli <juri.lelli@arm.com>
Link: http://lkml.kernel.org/r/1426590931-4639-1-git-send-email-wanpeng.li@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/sched/deadline.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 0a81a95..24c18dc 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1665,14 +1665,6 @@ static void switched_to_dl(struct rq *rq, struct task_struct *p)
 {
 	int check_resched = 1;
 
-	/*
-	 * If p is throttled, don't consider the possibility
-	 * of preempting rq->curr, the check will be done right
-	 * after its runtime will get replenished.
-	 */
-	if (unlikely(p->dl.dl_throttled))
-		return;
-
 	if (task_on_rq_queued(p) && rq->curr != p) {
 #ifdef CONFIG_SMP
 		if (p->nr_cpus_allowed > 1 && rq->dl.overloaded &&

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

* [tip:sched/core] sched/deadline: Fix rt runtime corruption when dl fails its global constraints
  2015-03-17 11:15 ` [PATCH v3 2/2] sched/deadline: fix rt runtime corrupt when dl refuse a smaller bandwidth Wanpeng Li
@ 2015-03-27 11:44   ` tip-bot for Wanpeng Li
  0 siblings, 0 replies; 5+ messages in thread
From: tip-bot for Wanpeng Li @ 2015-03-27 11:44 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: wanpeng.li, juri.lelli, hpa, peterz, mingo, tglx, linux-kernel

Commit-ID:  a1963b81deec54c113e770b0020e5f1c3188a087
Gitweb:     http://git.kernel.org/tip/a1963b81deec54c113e770b0020e5f1c3188a087
Author:     Wanpeng Li <wanpeng.li@linux.intel.com>
AuthorDate: Tue, 17 Mar 2015 19:15:31 +0800
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Fri, 27 Mar 2015 09:36:15 +0100

sched/deadline: Fix rt runtime corruption when dl fails its global constraints

One version of sched_rt_global_constaints() (the !rt-cgroup one)
changes state, therefore if we fail the later sched_dl_global_constraints()
call the state is left in an inconsistent state.

Fix this by changing the order of the calls.

Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
[ Improved the changelog. ]
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Juri Lelli <juri.lelli@arm.com>
Link: http://lkml.kernel.org/r/1426590931-4639-2-git-send-email-wanpeng.li@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/sched/core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 043e2a1..4b3b688 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -7804,7 +7804,7 @@ static int sched_rt_global_constraints(void)
 }
 #endif /* CONFIG_RT_GROUP_SCHED */
 
-static int sched_dl_global_constraints(void)
+static int sched_dl_global_validate(void)
 {
 	u64 runtime = global_rt_runtime();
 	u64 period = global_rt_period();
@@ -7905,11 +7905,11 @@ int sched_rt_handler(struct ctl_table *table, int write,
 		if (ret)
 			goto undo;
 
-		ret = sched_rt_global_constraints();
+		ret = sched_dl_global_validate();
 		if (ret)
 			goto undo;
 
-		ret = sched_dl_global_constraints();
+		ret = sched_rt_global_constraints();
 		if (ret)
 			goto undo;
 

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

end of thread, other threads:[~2015-03-27 11:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-17 11:15 [PATCH v3 1/2] sched/deadline: don't need to check throttled status when switched to dl Wanpeng Li
2015-03-17 11:15 ` [PATCH v3 2/2] sched/deadline: fix rt runtime corrupt when dl refuse a smaller bandwidth Wanpeng Li
2015-03-27 11:44   ` [tip:sched/core] sched/deadline: Fix rt runtime corruption when dl fails its global constraints tip-bot for Wanpeng Li
2015-03-19  4:20 ` [PATCH v3 1/2] sched/deadline: don't need to check throttled status when switched to dl Wanpeng Li
2015-03-27 11:43 ` [tip:sched/core] sched/deadline: Avoid a superfluous check tip-bot for Wanpeng Li

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.