[PATCH v8 3/6] cpufreq: powernv: Remove cpu_to_chip_id() from hot-path

Benjamin Herrenschmidt benh at au1.ibm.com
Sat Mar 19 09:37:15 AEDT 2016


On Fri, 2016-03-18 at 15:04 +1100, Michael Neuling wrote:
> 
>  static int nr_chips;
> +static DEFINE_PER_CPU(unsigned int, chip_id);
>  
>  /*
>   * Note: The set of pstates consists of contiguous integers, the
> @@ -317,9 +318,7 @@ static void powernv_cpufreq_throttle_check(void
> *data)
>  
>         pmsr = get_pmspr(SPRN_PMSR);
>  
> -       for (i = 0; i < nr_chips; i++)
> -               if (chips[i].id == cpu_to_chip_id(cpu))
> -                       break;
> +       i = this_cpu_read(chip_id);

Except it's not a chip_id, so your patch confused me for a good 2mn ...
Call it chip_idx maybe ? ie, index.

Cheers,
Ben.

>         /* Check for Pmax Capping */
>         pmsr_pmax = (s8)PMSR_MAX(pmsr);
> @@ -560,6 +559,7 @@ static int init_chip_info(void)
>         for_each_possible_cpu(cpu) {
>                 unsigned int id = cpu_to_chip_id(cpu);
>  
> +               per_cpu(chip_id, cpu) = nr_chips;
>                 if (prev_chip_id != id) {
>                         prev_chip_id = id;
>                         chip[nr_chips++] = id;
> _______________________________________________



More information about the Linuxppc-dev mailing list