difference between update_rq_clock and update_rq_clock_task

756 Views Asked by At

I understand the notion of update_rq_clock as it updates the run queue clock on system tick periodically. But this function calls update_rq_clock_task(). What is the purpose behind this function?

1

There are 1 best solutions below

2
On

Within update_rq_clock the difference between the CPU timestamp and the run queue clock is calculated (The rq->clock variable represents the last clock read from the CPU). That difference is added to the rq->clock and to the rq->clock_task (Which is the same as rq->clock - time for interrupts and stolen time) through update_rq_clock_task.

There are a couple of options within the function, which you can activate with kernel build options. But basically it breaks down to:

...
rq->clock_task += delta;
...
update_rq_clock_pelt(rq, delta);
...

So, both functions together update the clock of the run queue and the clock of the run queue without accounting for interrupts and stolen time (unless you activated that accounting through the kernel options), so the actual time that the tasks used.