Skip to content

Commit

Permalink
[POWERPC] Depend on ->initialized in calc_steal_time
Browse files Browse the repository at this point in the history
If CPU_FTR_PURR is not set, we will never set cpu_purr_data->initialized.
Checking via __get_cpu_var on 64 bit avoids one dependent load compared
to cpu_has_feature in the not-present case, and is always required when
it is present.  The code is under CONFIG_VIRT_CPU_ACCOUNTING so 32 bit
will not be affected.

Signed-off-by: Milton Miller <miltonm@bga.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
  • Loading branch information
Milton Miller authored and Paul Mackerras committed Dec 20, 2007
1 parent 6e6b44e commit db3801a
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions arch/powerpc/kernel/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,11 +329,9 @@ void calculate_steal_time(void)
s64 stolen;
struct cpu_purr_data *pme;

if (!cpu_has_feature(CPU_FTR_PURR))
return;
pme = &__get_cpu_var(cpu_purr_data);
if (!pme->initialized)
return; /* this can happen in early boot */
return; /* !CPU_FTR_PURR or early in early boot */
tb = mftb();
purr = mfspr(SPRN_PURR);
stolen = (tb - pme->tb) - (purr - pme->purr);
Expand Down

0 comments on commit db3801a

Please sign in to comment.