summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/linux/sched.h2
-rw-r--r--kernel/sched.c5
2 files changed, 4 insertions, 3 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index f5d4b9cae523..90f5cb645116 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -449,7 +449,7 @@ struct task_struct {
unsigned long sleep_avg;
long interactive_credit;
- unsigned long long timestamp;
+ unsigned long long timestamp, last_ran;
int activated;
unsigned long policy;
diff --git a/kernel/sched.c b/kernel/sched.c
index 9b395e8d616d..b1643e495f1f 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -180,7 +180,8 @@ static unsigned int task_timeslice(task_t *p)
else
return SCALE_PRIO(DEF_TIMESLICE, p->static_prio);
}
-#define task_hot(p, now, sd) ((now) - (p)->timestamp < (sd)->cache_hot_time)
+#define task_hot(p, now, sd) ((long long) ((now) - (p)->last_ran) \
+ < (long long) (sd)->cache_hot_time)
enum idle_type
{
@@ -2764,7 +2765,7 @@ switch_tasks:
if (!(HIGH_CREDIT(prev) || LOW_CREDIT(prev)))
prev->interactive_credit--;
}
- prev->timestamp = now;
+ prev->timestamp = prev->last_ran = now;
sched_info_switch(prev, next);
if (likely(prev != next)) {