From: Rik van Riel <[email protected]>

Teach account_process_tick to work on the CPU of the task
specified in the function argument. This allows us to do
remote tick based sampling of a nohz_full cpu from a
housekeeping CPU.

Signed-off-by: Rik van Riel <[email protected]>
---
 kernel/sched/cputime.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c
index 8394b1ee600c..97077c282626 100644
--- a/kernel/sched/cputime.c
+++ b/kernel/sched/cputime.c
@@ -463,8 +463,14 @@ void thread_group_cputime_adjusted(struct task_struct *p, 
cputime_t *ut, cputime
 void account_process_tick(struct task_struct *p, int user_tick)
 {
        cputime_t one_jiffy_scaled = cputime_to_scaled(cputime_one_jiffy);
-       struct rq *rq = this_rq();
+       int cpu = task_cpu(p);
+       struct rq *rq = cpu_rq(cpu);
 
+       /*
+        * Tests current CPU, not "cpu", to see whether account_process_tick()
+        * should do work on this invocation, or whether time keeping for
+        * this CPU is done in some other way.
+        */
        if (vtime_accounting_enabled())
                return;
 
-- 
2.1.0

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

Reply via email to