Skip to content
This repository has been archived by the owner on Mar 17, 2019. It is now read-only.

Commit

Permalink
msm-core: Improve sampling conditioning
Browse files Browse the repository at this point in the history
After an investigation it looks like work_busy() is pretty
unreliable. So instead we just check whether the appropriate
mutex is locked.

Also move the sampling conditioning to a seperate
method: should_run_resampling()

Change-Id: If39b2eecfaa2c32b55e1cf44b0d416a7c21afcc4
Signed-off-by: Alex Naidis <[email protected]>
Signed-off-by: Alex Naidis <[email protected]>
Signed-off-by: Harsh Shandilya <[email protected]>
  • Loading branch information
TheCrazyLex authored and Harsh Shandilya committed Jan 7, 2018
1 parent 899057b commit 6f8d3ac
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions drivers/power/qcom/msm-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,18 @@ static void set_threshold(struct cpu_activity_info *cpu_node)
&cpu_node->low_threshold);
}

static inline bool should_run_resampling(void)
{
if (!mutex_is_locked(&suspend_update_mutex) && !in_suspend)
return true;
else
return false;
}

static inline void schedule_sampling(void)
{
if (!work_busy(&sampling_work) && !in_suspend)
if (should_run_resampling())
queue_work(msm_core_wq, &sampling_work);

}

/* May be called from an interrupt context */
Expand Down Expand Up @@ -317,10 +324,10 @@ static inline void do_sampling(void)
struct cpu_activity_info *cpu_node;
static int prev_temp[NR_CPUS];

mutex_lock(&suspend_update_mutex);
if (in_suspend)
goto unlock;
if (!should_run_resampling())
return;

mutex_lock(&suspend_update_mutex);
trigger_cpu_pwr_stats_calc();

for_each_online_cpu(cpu) {
Expand All @@ -335,7 +342,6 @@ static inline void do_sampling(void)
scaling_factor);
}
}
unlock:
mutex_unlock(&suspend_update_mutex);
}

Expand Down

0 comments on commit 6f8d3ac

Please sign in to comment.