|
@@ -2474,31 +2474,6 @@ DEFINE_PER_CPU(struct kernel_cpustat, kernel_cpustat);
|
|
EXPORT_PER_CPU_SYMBOL(kstat);
|
|
EXPORT_PER_CPU_SYMBOL(kstat);
|
|
EXPORT_PER_CPU_SYMBOL(kernel_cpustat);
|
|
EXPORT_PER_CPU_SYMBOL(kernel_cpustat);
|
|
|
|
|
|
-/*
|
|
|
|
- * Return any ns on the sched_clock that have not yet been accounted in
|
|
|
|
- * @p in case that task is currently running.
|
|
|
|
- *
|
|
|
|
- * Called with task_rq_lock() held on @rq.
|
|
|
|
- */
|
|
|
|
-static u64 do_task_delta_exec(struct task_struct *p, struct rq *rq)
|
|
|
|
-{
|
|
|
|
- u64 ns = 0;
|
|
|
|
-
|
|
|
|
- /*
|
|
|
|
- * Must be ->curr _and_ ->on_rq. If dequeued, we would
|
|
|
|
- * project cycles that may never be accounted to this
|
|
|
|
- * thread, breaking clock_gettime().
|
|
|
|
- */
|
|
|
|
- if (task_current(rq, p) && task_on_rq_queued(p)) {
|
|
|
|
- update_rq_clock(rq);
|
|
|
|
- ns = rq_clock_task(rq) - p->se.exec_start;
|
|
|
|
- if ((s64)ns < 0)
|
|
|
|
- ns = 0;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return ns;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
/*
|
|
/*
|
|
* Return accounted runtime for the task.
|
|
* Return accounted runtime for the task.
|
|
* In case the task is currently running, return the runtime plus current's
|
|
* In case the task is currently running, return the runtime plus current's
|
|
@@ -2508,7 +2483,7 @@ unsigned long long task_sched_runtime(struct task_struct *p)
|
|
{
|
|
{
|
|
unsigned long flags;
|
|
unsigned long flags;
|
|
struct rq *rq;
|
|
struct rq *rq;
|
|
- u64 ns = 0;
|
|
|
|
|
|
+ u64 ns;
|
|
|
|
|
|
#if defined(CONFIG_64BIT) && defined(CONFIG_SMP)
|
|
#if defined(CONFIG_64BIT) && defined(CONFIG_SMP)
|
|
/*
|
|
/*
|
|
@@ -2527,7 +2502,16 @@ unsigned long long task_sched_runtime(struct task_struct *p)
|
|
#endif
|
|
#endif
|
|
|
|
|
|
rq = task_rq_lock(p, &flags);
|
|
rq = task_rq_lock(p, &flags);
|
|
- ns = p->se.sum_exec_runtime + do_task_delta_exec(p, rq);
|
|
|
|
|
|
+ /*
|
|
|
|
+ * Must be ->curr _and_ ->on_rq. If dequeued, we would
|
|
|
|
+ * project cycles that may never be accounted to this
|
|
|
|
+ * thread, breaking clock_gettime().
|
|
|
|
+ */
|
|
|
|
+ if (task_current(rq, p) && task_on_rq_queued(p)) {
|
|
|
|
+ update_rq_clock(rq);
|
|
|
|
+ p->sched_class->update_curr(rq);
|
|
|
|
+ }
|
|
|
|
+ ns = p->se.sum_exec_runtime;
|
|
task_rq_unlock(rq, p, &flags);
|
|
task_rq_unlock(rq, p, &flags);
|
|
|
|
|
|
return ns;
|
|
return ns;
|