aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index c6e551de795b..3df84ea6aba9 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -508,10 +508,15 @@ EXPORT_SYMBOL_GPL(cpu_clock);
508# define finish_arch_switch(prev) do { } while (0) 508# define finish_arch_switch(prev) do { } while (0)
509#endif 509#endif
510 510
511static inline int task_current(struct rq *rq, struct task_struct *p)
512{
513 return rq->curr == p;
514}
515
511#ifndef __ARCH_WANT_UNLOCKED_CTXSW 516#ifndef __ARCH_WANT_UNLOCKED_CTXSW
512static inline int task_running(struct rq *rq, struct task_struct *p) 517static inline int task_running(struct rq *rq, struct task_struct *p)
513{ 518{
514 return rq->curr == p; 519 return task_current(rq, p);
515} 520}
516 521
517static inline void prepare_lock_switch(struct rq *rq, struct task_struct *next) 522static inline void prepare_lock_switch(struct rq *rq, struct task_struct *next)
@@ -540,7 +545,7 @@ static inline int task_running(struct rq *rq, struct task_struct *p)
540#ifdef CONFIG_SMP 545#ifdef CONFIG_SMP
541 return p->oncpu; 546 return p->oncpu;
542#else 547#else
543 return rq->curr == p; 548 return task_current(rq, p);
544#endif 549#endif
545} 550}
546 551
@@ -663,6 +668,7 @@ void sched_clock_idle_wakeup_event(u64 delta_ns)
663 struct rq *rq = cpu_rq(smp_processor_id()); 668 struct rq *rq = cpu_rq(smp_processor_id());
664 u64 now = sched_clock(); 669 u64 now = sched_clock();
665 670
671 touch_softlockup_watchdog();
666 rq->idle_clock += delta_ns; 672 rq->idle_clock += delta_ns;
667 /* 673 /*
668 * Override the previous timestamp and ignore all 674 * Override the previous timestamp and ignore all
@@ -3334,7 +3340,7 @@ unsigned long long task_sched_runtime(struct task_struct *p)
3334 3340
3335 rq = task_rq_lock(p, &flags); 3341 rq = task_rq_lock(p, &flags);
3336 ns = p->se.sum_exec_runtime; 3342 ns = p->se.sum_exec_runtime;
3337 if (rq->curr == p) { 3343 if (task_current(rq, p)) {
3338 update_rq_clock(rq); 3344 update_rq_clock(rq);
3339 delta_exec = rq->clock - p->se.exec_start; 3345 delta_exec = rq->clock - p->se.exec_start;
3340 if ((s64)delta_exec > 0) 3346 if ((s64)delta_exec > 0)
@@ -4021,7 +4027,7 @@ void rt_mutex_setprio(struct task_struct *p, int prio)
4021 4027
4022 oldprio = p->prio; 4028 oldprio = p->prio;
4023 on_rq = p->se.on_rq; 4029 on_rq = p->se.on_rq;
4024 running = task_running(rq, p); 4030 running = task_current(rq, p);
4025 if (on_rq) { 4031 if (on_rq) {
4026 dequeue_task(rq, p, 0); 4032 dequeue_task(rq, p, 0);
4027 if (running) 4033 if (running)
@@ -4332,7 +4338,7 @@ recheck:
4332 } 4338 }
4333 update_rq_clock(rq); 4339 update_rq_clock(rq);
4334 on_rq = p->se.on_rq; 4340 on_rq = p->se.on_rq;
4335 running = task_running(rq, p); 4341 running = task_current(rq, p);
4336 if (on_rq) { 4342 if (on_rq) {
4337 deactivate_task(rq, p, 0); 4343 deactivate_task(rq, p, 0);
4338 if (running) 4344 if (running)
@@ -7101,7 +7107,7 @@ void sched_move_task(struct task_struct *tsk)
7101 7107
7102 update_rq_clock(rq); 7108 update_rq_clock(rq);
7103 7109
7104 running = task_running(rq, tsk); 7110 running = task_current(rq, tsk);
7105 on_rq = tsk->se.on_rq; 7111 on_rq = tsk->se.on_rq;
7106 7112
7107 if (on_rq) { 7113 if (on_rq) {