lkml.org 
[lkml]   [2020]   [Nov]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH V4 2/3] sched/core: Rename schedutil_cpu_util() and allow rest of the kernel to use it
    Hey Viresh,

    On Tuesday 24 Nov 2020 at 11:56:15 (+0530), Viresh Kumar wrote:
    > There is nothing schedutil specific in schedutil_cpu_util(), rename it
    > to effective_cpu_util(). Also create and expose another wrapper
    > sched_cpu_util() which can be used by other parts of the kernel, like
    > thermal core (that will be done in a later commit).
    >
    > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
    > ---
    > include/linux/sched.h | 21 +++++++++++++++++++++
    > kernel/sched/core.c | 11 +++++++++--
    > kernel/sched/cpufreq_schedutil.c | 2 +-
    > kernel/sched/fair.c | 6 +++---
    > kernel/sched/sched.h | 19 ++-----------------
    > 5 files changed, 36 insertions(+), 23 deletions(-)
    >
    > diff --git a/include/linux/sched.h b/include/linux/sched.h
    > index 063cd120b459..926b944dae5e 100644
    > --- a/include/linux/sched.h
    > +++ b/include/linux/sched.h
    > @@ -1926,6 +1926,27 @@ extern long sched_getaffinity(pid_t pid, struct cpumask *mask);
    > #define TASK_SIZE_OF(tsk) TASK_SIZE
    > #endif
    >
    > +#ifdef CONFIG_SMP
    > +/**
    > + * enum cpu_util_type - CPU utilization type
    > + * @FREQUENCY_UTIL: Utilization used to select frequency
    > + * @ENERGY_UTIL: Utilization used during energy calculation
    > + *
    > + * The utilization signals of all scheduling classes (CFS/RT/DL) and IRQ time
    > + * need to be aggregated differently depending on the usage made of them. This
    > + * enum is used within sched_cpu_util() to differentiate the types of
    > + * utilization expected by the callers, and adjust the aggregation accordingly.
    > + */
    > +enum cpu_util_type {
    > + FREQUENCY_UTIL,
    > + ENERGY_UTIL,
    > +};
    > +
    > +/* Returns effective CPU utilization, as seen by the scheduler */
    > +unsigned long sched_cpu_util(int cpu, enum cpu_util_type type,
    > + unsigned long max);

    Are 'type' and 'max' useful to anybody outside of kernel/sched ?
    If not then how about we hide them, keep the cpu_util_type enum in
    kernel/sched/sched.h and evaluate arch_scale_cpu_capacity() in
    sched_cpu_util() directly?

    Thanks,
    Quentin

    \
     
     \ /
      Last update: 2020-11-24 10:12    [W:2.511 / U:0.664 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site