[PATCH] PPC64 collect and export low-level cpu usage statistics

linas linas at austin.ibm.com
Fri Jan 27 07:36:25 EST 2006


Hi,


On Thu, Jan 19, 2006 at 10:38:44AM -0600, Manish Ahuja was heard to remark:
> Index: linux-2.6.15-rc6/arch/powerpc/kernel/setup_64.c
>
> +/* To initialize and collect statics for user and kernel times

typo: s/statics/statistics/

> +static void post_cpu_deltas(cpu)
> +{
> +	struct cpu_usage *pd = &per_cpu(cpu_usage_array, cpu);
> +	u64 total_timebase, total_cpu_util;
> +	total_timebase = (pd->collected_timebase - pd->start_timebase);
> +	total_cpu_util = pd->current_cpu_util - pd->start_cpu_util;
> +	offline_cpu_total_tb += total_timebase;
> +	offline_cpu_total_cpu_util += total_cpu_util;
> +	offline_cpu_total_krncycles += pd->collected_krntb;
> +	offline_cpu_total_idle += (total_timebase - total_cpu_util);
> +}

What prevents races here? You might s/might/typically will/ 
have multiple cpus going down at he same time, in which case
they are all racing to update these saem global variables, 
and will potentially clobber each other. Right?

--linas



More information about the Linuxppc64-dev mailing list