Skip to contentSkip to conversation

sched/stop_task: Do not account zero delta_exec in put_prev_task_stop

PATCH In review Kirill Tkhai 3 participants 4 messages Feb 11, 2013 – Feb 14, 2013 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched/stop_task: Do not account zero delta_exec in put_prev_task_stop

Simple return

CC Steven Rostedt <[email protected]>
CC Ingo Molnar <[email protected]>
CC Peter Zijlstra <[email protected]>
CC linux-rt-users <[email protected]>
---
 kernel/sched/stop_task.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/sched/stop_task.c +2 -2
index da5eb5b..78d0458 100644
@@ -58,8 +58,8 @@ static void put_prev_task_stop(struct rq *rq, struct task_struct *prev)
 	u64 delta_exec;
 
 	delta_exec = rq->clock_task - curr->se.exec_start;
-	if (unlikely((s64)delta_exec < 0))
-		delta_exec = 0;
+	if (unlikely((s64)delta_exec <= 0))
+		return;
 
 	schedstat_set(curr->se.statistics.exec_max,
 			max(curr->se.statistics.exec_max, delta_exec));
#1 lore raw

Hi Kirill,

Quoted 15 lines · Kirill Tkhai

Simple return

CC Steven Rostedt <[email protected]>
CC Ingo Molnar <[email protected]>
CC Peter Zijlstra <[email protected]>
CC linux-rt-users <[email protected]>
---
 kernel/sched/stop_task.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/sched/stop_task.c +0 -0
index da5eb5b..78d0458 100644

kernel/sched/stop_task.c static void put_prev_task_stop(struct rq *rq, struct task_struct *prev) · line 62

Quoted 7 lines
kernel/sched/stop_task.c +2 -2
@@ -58,8 +58,8 @@ static void put_prev_task_stop(struct rq *rq, struct task_struct *prev)
 	u64 delta_exec;
 
 	delta_exec = rq->clock_task - curr->se.exec_start;
-	if (unlikely((s64)delta_exec < 0))
-		delta_exec = 0;
+	if (unlikely((s64)delta_exec <= 0))
+		return;

It seems it needs to update curr->se.exec_start then.

Thanks,
Namhyung

Quoted 7 lines
kernel/sched/stop_task.c +0 -1
 	schedstat_set(curr->se.statistics.exec_max,
 			max(curr->se.statistics.exec_max, delta_exec));
--

To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
In reply to Kirill Tkhai
Quoted 2 lines · Kirill Tkhai

Simple return

I'll ack the patch, but I nack the change log. Please write something up that's a little more descriptive.

Thanks,

-- Steve

Quoted 23 lines
CC Steven Rostedt <[email protected]>
CC Ingo Molnar <[email protected]>
CC Peter Zijlstra <[email protected]>
CC linux-rt-users <[email protected]>
---
 kernel/sched/stop_task.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/sched/stop_task.c +2 -2
index da5eb5b..78d0458 100644
@@ -58,8 +58,8 @@ static void put_prev_task_stop(struct rq *rq, struct task_struct *prev)
 	u64 delta_exec;
 
 	delta_exec = rq->clock_task - curr->se.exec_start;
-	if (unlikely((s64)delta_exec < 0))
-		delta_exec = 0;
+	if (unlikely((s64)delta_exec <= 0))
+		return;
 
 	schedstat_set(curr->se.statistics.exec_max,
 			max(curr->se.statistics.exec_max, delta_exec));
#2 lore raw
In reply to Namhyung Kim
Quoted 10 lines · Namhyung Kim

---

Quoted 9 lines
 kernel/sched/stop_task.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/sched/stop_task.c +0 -0
index da5eb5b..78d0458 100644
@@ -58,8 +58,8 @@ static void put_prev_task_stop(struct rq *rq, struct task_struct *prev)
 	u64 delta_exec;
 
Quoted 8 lines

kernel/sched/stop_task.c static void put_prev_task_stop(struct rq *rq, struct task_struct *prev) · line 62

Quoted 5 lines
kernel/sched/stop_task.c +2 -2
 	delta_exec = rq->clock_task - curr->se.exec_start;
-	if (unlikely((s64)delta_exec < 0))
-		delta_exec = 0;
+	if (unlikely((s64)delta_exec <= 0))
+		return;

It seems it needs to update curr->se.exec_start then.

Ah, if it's less than zero, it does.

A better patch would be:

	if (unlikely((s64)delta_exec <= 0)) {
		curr->se.exec_start = rq->clock_task;
		return;
	}

Thanks!

-- Steve