Collect real process and processor utilization values when virtualization is enabled.

Paul Mackerras paulus at
Wed Jan 12 13:36:56 EST 2005

Manish Ahuja writes:

> This patch enables that feature. The current purr (processor Utilization 
> register )
> values of each of the processors is stored in a per_cpu data array. this 
> is then
> summed and used to calculate various numbers for managing lpars.

Don't you also need to update purr_data_array in timer_interrupt as
well?  You seem to be doing that only on context switch, which won't
be updated in a timely fashion necessarily (think of a compute-bound
task on a lightly-loaded machine).

> +	for_each_cpu(cpu){
> +		cus = &per_cpu(purr_data_array, cpu);
> +		sum_purr += cus->current_purr;
> +		}

The spacing is wrong here, it should be "for_each_cpu(cpu) {" and the
"}" should be one tab to the left of where it is.

> +/* Used to store Processor Utilization register (purr) values */
> +DECLARE_PER_CPU(struct purr_data, purr_data_array);
> +
> +struct purr_data {
> +        u64 current_purr;  /* Holds the current purr register values */
> +};

Do we really need a struct to store one thing?  Are there other things
you plan to add later?


More information about the Linuxppc64-dev mailing list