question about logic of steal_account_process_tick() ?

From: Chris Friesen
Date: Fri Mar 04 2016 - 14:51:17 EST


I'm trying to wrap my head around how steal_account_process_tick() interacts with account_process_tick().

Suppose we have CONFIG_VIRT_CPU_ACCOUNTING_GEN=y and CONFIG_NO_HZ_IDLE, with a cpu hog on cpu0 to prevent it going idle.

As I understand it, account_process_tick() will be called once per tick to decide whether that tick should be allocated against user/system/idle. However, it first calls steal_account_process_tick() and then returns if that returns a nonzero value.

The thing is, steal_account_process_tick() returns units of cputime, which I think is nanoseconds on x86_64. So if we have a tiny amount of stolen time it seems like that will prevent a whole tick from being accounted into user/system/idle.

I feel like I must be missing something here, can someone tell me what it is?

Chris