The callers of steal_account_process_tick() expect it to return whether
the last jiffy was stolen or not.
    
Currently the return value of steal_account_process_tick() is in units
of cputime, which vary between either jiffies or nsecs depending on
CONFIG_VIRT_CPU_ACCOUNTING_GEN.
    
The fix is to change steal_account_process_tick() to always return
jiffies.  If CONFIG_VIRT_CPU_ACCOUNTING_GEN is not enabled then this
is a no-op.

As far as I can tell this bug has been present since commit dee08a72.

Signed-off-by: Chris Friesen <[email protected]>
---

 kernel/sched/cputime.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c
index b2ab2ff..e724496 100644
--- a/kernel/sched/cputime.c
+++ b/kernel/sched/cputime.c
@@ -276,7 +276,7 @@ static __always_inline bool steal_account_process_tick(void)
                this_rq()->prev_steal_time += cputime_to_nsecs(steal_ct);
 
                account_steal_time(steal_ct);
-               return steal_ct;
+               return cputime_to_jiffies(steal_ct);
        }
 #endif
        return false;

Reply via email to