2014-11-06 07:22:59

by Wanpeng Li

[permalink] [raw]
Subject: [PATCH] sched/deadline: fix rq->dl.pushable_tasks bug in push_dl_task()

Do not call dequeue_pushable_dl_task() when failing to push an eligible
task, as it remains pushable, merely not at this particular moment.
Actually the patch is the same behavior as commit 311e800e16f6 ("sched,
rt: Fix rq->rt.pushable_tasks bug in push_rt_task()" in -rt side.

Signed-off-by: Wanpeng Li <[email protected]>
---
kernel/sched/deadline.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index f3d7776..00324af 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1331,6 +1331,7 @@ static int push_dl_task(struct rq *rq)
{
struct task_struct *next_task;
struct rq *later_rq;
+ int ret = 0;

if (!rq->dl.overloaded)
return 0;
@@ -1376,7 +1377,6 @@ retry:
* The task is still there. We don't try
* again, some other cpu will pull it when ready.
*/
- dequeue_pushable_dl_task(rq, next_task);
goto out;
}

@@ -1392,6 +1392,7 @@ retry:
deactivate_task(rq, next_task, 0);
set_task_cpu(next_task, later_rq->cpu);
activate_task(later_rq, next_task, 0);
+ ret = 1;

resched_curr(later_rq);

@@ -1400,7 +1401,7 @@ retry:
out:
put_task_struct(next_task);

- return 1;
+ return ret;
}

static void push_dl_tasks(struct rq *rq)
--
1.9.1


2014-11-11 07:44:25

by Wanpeng Li

[permalink] [raw]
Subject: Re: [PATCH] sched/deadline: fix rq->dl.pushable_tasks bug in push_dl_task()

Ping Juri, could you review this one and other deadline patches of mine?
;-)
On 14/11/6 下午3:22, Wanpeng Li wrote:
> Do not call dequeue_pushable_dl_task() when failing to push an eligible
> task, as it remains pushable, merely not at this particular moment.
> Actually the patch is the same behavior as commit 311e800e16f6 ("sched,
> rt: Fix rq->rt.pushable_tasks bug in push_rt_task()" in -rt side.
>
> Signed-off-by: Wanpeng Li <[email protected]>
> ---
> kernel/sched/deadline.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> index f3d7776..00324af 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
> @@ -1331,6 +1331,7 @@ static int push_dl_task(struct rq *rq)
> {
> struct task_struct *next_task;
> struct rq *later_rq;
> + int ret = 0;
>
> if (!rq->dl.overloaded)
> return 0;
> @@ -1376,7 +1377,6 @@ retry:
> * The task is still there. We don't try
> * again, some other cpu will pull it when ready.
> */
> - dequeue_pushable_dl_task(rq, next_task);
> goto out;
> }
>
> @@ -1392,6 +1392,7 @@ retry:
> deactivate_task(rq, next_task, 0);
> set_task_cpu(next_task, later_rq->cpu);
> activate_task(later_rq, next_task, 0);
> + ret = 1;
>
> resched_curr(later_rq);
>
> @@ -1400,7 +1401,7 @@ retry:
> out:
> put_task_struct(next_task);
>
> - return 1;
> + return ret;
> }
>
> static void push_dl_tasks(struct rq *rq)

2014-11-13 09:30:04

by Juri Lelli

[permalink] [raw]
Subject: Re: [PATCH] sched/deadline: fix rq->dl.pushable_tasks bug in push_dl_task()

Hi,

On 06/11/14 07:22, Wanpeng Li wrote:
> Do not call dequeue_pushable_dl_task() when failing to push an eligible
> task, as it remains pushable, merely not at this particular moment.
> Actually the patch is the same behavior as commit 311e800e16f6 ("sched,
> rt: Fix rq->rt.pushable_tasks bug in push_rt_task()" in -rt side.
>
> Signed-off-by: Wanpeng Li <[email protected]>
> ---
> kernel/sched/deadline.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> index f3d7776..00324af 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
> @@ -1331,6 +1331,7 @@ static int push_dl_task(struct rq *rq)
> {
> struct task_struct *next_task;
> struct rq *later_rq;
> + int ret = 0;
>
> if (!rq->dl.overloaded)
> return 0;
> @@ -1376,7 +1377,6 @@ retry:
> * The task is still there. We don't try
> * again, some other cpu will pull it when ready.
> */
> - dequeue_pushable_dl_task(rq, next_task);
> goto out;
> }
>
> @@ -1392,6 +1392,7 @@ retry:
> deactivate_task(rq, next_task, 0);
> set_task_cpu(next_task, later_rq->cpu);
> activate_task(later_rq, next_task, 0);
> + ret = 1;
>
> resched_curr(later_rq);
>
> @@ -1400,7 +1401,7 @@ retry:
> out:
> put_task_struct(next_task);
>
> - return 1;
> + return ret;
> }
>
> static void push_dl_tasks(struct rq *rq)
>

This looks good.

Acked-by: Juri Lelli <[email protected]>

Thanks,

- Juri

Subject: [tip:sched/core] sched/deadline: Fix rq-> dl.pushable_tasks bug in push_dl_task()

Commit-ID: c51b8ab5ad972df26fd9c0ffad34870e98273c4c
Gitweb: http://git.kernel.org/tip/c51b8ab5ad972df26fd9c0ffad34870e98273c4c
Author: Wanpeng Li <[email protected]>
AuthorDate: Thu, 6 Nov 2014 15:22:44 +0800
Committer: Ingo Molnar <[email protected]>
CommitDate: Sun, 16 Nov 2014 10:58:57 +0100

sched/deadline: Fix rq->dl.pushable_tasks bug in push_dl_task()

Do not call dequeue_pushable_dl_task() when failing to push an eligible
task, as it remains pushable, merely not at this particular moment.

Actually the patch is the same behavior as commit 311e800e16f6 ("sched,
rt: Fix rq->rt.pushable_tasks bug in push_rt_task()" in -rt side.

Signed-off-by: Wanpeng Li <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Cc: Juri Lelli <[email protected]>
Cc: Kirill Tkhai <[email protected]>
Cc: Linus Torvalds <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
---
kernel/sched/deadline.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index bb1464b..9594c12 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1328,6 +1328,7 @@ static int push_dl_task(struct rq *rq)
{
struct task_struct *next_task;
struct rq *later_rq;
+ int ret = 0;

if (!rq->dl.overloaded)
return 0;
@@ -1373,7 +1374,6 @@ retry:
* The task is still there. We don't try
* again, some other cpu will pull it when ready.
*/
- dequeue_pushable_dl_task(rq, next_task);
goto out;
}

@@ -1389,6 +1389,7 @@ retry:
deactivate_task(rq, next_task, 0);
set_task_cpu(next_task, later_rq->cpu);
activate_task(later_rq, next_task, 0);
+ ret = 1;

resched_curr(later_rq);

@@ -1397,7 +1398,7 @@ retry:
out:
put_task_struct(next_task);

- return 1;
+ return ret;
}

static void push_dl_tasks(struct rq *rq)