mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-04-15 21:47:40 +07:00
[CPUFREQ] ondemand: add a check to avoid negative load calculation
Due to rounding and inexact jiffy accounting, idle_ticks can sometimes be higher than total_ticks. Make sure those cases are handled as zero load case. Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> Signed-off-by: Dave Jones <davej@redhat.com>
This commit is contained in:
parent
c7f652e048
commit
0af99b13c9
@ -325,7 +325,7 @@ static struct attribute_group dbs_attr_group = {
|
|||||||
static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
|
static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
|
||||||
{
|
{
|
||||||
unsigned int idle_ticks, total_ticks;
|
unsigned int idle_ticks, total_ticks;
|
||||||
unsigned int load;
|
unsigned int load = 0;
|
||||||
cputime64_t cur_jiffies;
|
cputime64_t cur_jiffies;
|
||||||
|
|
||||||
struct cpufreq_policy *policy;
|
struct cpufreq_policy *policy;
|
||||||
@ -370,6 +370,7 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
|
|||||||
if (tmp_idle_ticks < idle_ticks)
|
if (tmp_idle_ticks < idle_ticks)
|
||||||
idle_ticks = tmp_idle_ticks;
|
idle_ticks = tmp_idle_ticks;
|
||||||
}
|
}
|
||||||
|
if (likely(total_ticks > idle_ticks))
|
||||||
load = (100 * (total_ticks - idle_ticks)) / total_ticks;
|
load = (100 * (total_ticks - idle_ticks)) / total_ticks;
|
||||||
|
|
||||||
/* Check for frequency increase */
|
/* Check for frequency increase */
|
||||||
|
Loading…
Reference in New Issue
Block a user