From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from sullivan.realtime.net (sullivan.realtime.net [205.238.132.226]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTP id B0FA7DE0D5 for ; Fri, 14 Dec 2007 15:52:23 +1100 (EST) Date: Thu, 13 Dec 2007 22:52:19 -0600 (CST) From: Milton Miller Sender: Milton Miller To: Paul Mackerras Subject: [PATCH 5/6] depend on ->initialized in calc_steal_time In-Reply-To: Message-Id: Cc: linuxppc-dev@ozlabs.org List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 --- Index: kernel/arch/powerpc/kernel/time.c =================================================================== --- kernel.orig/arch/powerpc/kernel/time.c 2007-12-13 18:16:10.000000000 -0600 +++ kernel/arch/powerpc/kernel/time.c 2007-12-13 18:23:55.000000000 -0600 @@ -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);