summaryrefslogtreecommitdiff
path: root/kernel/sched.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 29a3152c45db..ebb03def564b 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -4042,10 +4042,12 @@ EXPORT_PER_CPU_SYMBOL(kstat);
*/
unsigned long long task_delta_exec(struct task_struct *p)
{
- struct rq *rq;
unsigned long flags;
+ struct rq *rq;
u64 ns = 0;
+ rq = task_rq_lock(p, &flags);
+
if (task_current(rq, p)) {
u64 delta_exec;
@@ -4055,6 +4057,8 @@ unsigned long long task_delta_exec(struct task_struct *p)
ns = delta_exec;
}
+ task_rq_unlock(rq, &flags);
+
return ns;
}