sched/cputime: Introduce vtime accounting check for readers

Readers need to know if vtime runs at all on some CPU somewhere, this
is a fast-path check to determine if we need to check further the need
to add up any tickless cputime delta.

This fast path check uses context tracking state because vtime is tied
to context tracking as of now. This check appears to be confusing though
so lets use a vtime function that deals with context tracking details
in vtime implementation instead.

Signed-off-by: Frederic Weisbecker <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Cc: Chris Metcalf <[email protected]>
Cc: Christoph Lameter <[email protected]>
Cc: Hiroshi Shimamoto <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Luiz Capitulino <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Paul E . McKenney <[email protected]>
Cc: Paul E. McKenney <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Rik van Riel <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
This commit is contained in:
Frederic Weisbecker 2015-11-19 16:47:33 +01:00 • committed by Ingo Molnar
commit e592539466
2 changed files with 15 additions and 4 deletions

View file

@ -788,7 +788,7 @@ cputime_t task_gtime(struct task_struct *t)
unsigned int seq;
cputime_t gtime;
if (!context_tracking_is_enabled())
if (!vtime_accounting_enabled())
return t->gtime;
do {
@ -853,7 +853,7 @@ void task_cputime(struct task_struct *t, cputime_t *utime, cputime_t *stime)
{
cputime_t udelta, sdelta;
if (!context_tracking_is_enabled()) {
if (!vtime_accounting_enabled()) {
if (utime)
*utime = t->utime;
if (stime)
@ -874,7 +874,7 @@ void task_cputime_scaled(struct task_struct *t,
{
cputime_t udelta, sdelta;
if (!context_tracking_is_enabled()) {
if (!vtime_accounting_enabled()) {
if (utimescaled)
*utimescaled = t->utimescaled;
if (stimescaled)