lkml.org 
[lkml]   [2018]   [Jul]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [RFC PATCH v4 03/12] PM: Introduce an Energy Model management framework
    On Thu, Jun 28, 2018 at 12:40:34PM +0100, Quentin Perret wrote:
    > +/* fd_update_cs_table() - Computes the capacity values of a cs_table
    > + *
    > + * This assumes a linear relation between capacity and frequency. As such,
    > + * the capacity of a CPU at the n^th capacity state is computed as:
    > + * capactity(n) = max_capacity * freq(n) / freq_max
    > + */

    Broken comment style

    > +static void fd_update_cs_table(struct em_cs_table *cs_table, int cpu)
    > +{
    > + unsigned long cmax = arch_scale_cpu_capacity(NULL, cpu);
    > + int max_cap_state = cs_table->nr_cap_states - 1;
    > + unsigned long fmax = cs_table->state[max_cap_state].frequency;
    > + int i;
    > +
    > + for (i = 0; i < cs_table->nr_cap_states; i++) {
    > + u64 cap = (u64)cmax * cs_table->state[i].frequency;
    > + do_div(cap, fmax);
    > + cs_table->state[i].capacity = (unsigned long)cap;

    I prefer div64_*() over do_div(), the calling convention the latter
    always confuses the heck out of me.

    So this then becomes something like:

    cs_table->state[i].capacity =
    div64_u64(cmax * cs_table->state[i].frequency, fmax);

    > + }
    > +}

    \
     
     \ /
      Last update: 2018-07-05 17:06    [W:4.096 / U:0.984 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site