Skip to content

Commit

Permalink
Merge branches 'pm-cpufreq-sched' and 'pm-cpuidle'
Browse files Browse the repository at this point in the history
* pm-cpufreq-sched:
  cpufreq: schedutil: Avoid missing updates for one-CPU policies
  schedutil: Allow cpufreq requests to be made even when kthread kicked
  cpufreq: Rename cpufreq_can_do_remote_dvfs()
  cpufreq: schedutil: Cleanup and document iowait boost
  cpufreq: schedutil: Fix iowait boost reset
  cpufreq: schedutil: Don't set next_freq to UINT_MAX
  Revert "cpufreq: schedutil: Don't restrict kthread to related_cpus unnecessarily"

* pm-cpuidle:
  cpuidle: governors: Consolidate PM QoS handling
  cpuidle: governors: Drop redundant checks related to PM QoS
  • Loading branch information
rafaeljw committed Jun 4, 2018
3 parents e27f84e + a61dec7 + 0fc784f commit 601ef1f
Show file tree
Hide file tree
Showing 7 changed files with 200 additions and 104 deletions.
2 changes: 1 addition & 1 deletion drivers/cpufreq/cpufreq_governor.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ static void dbs_update_util_handler(struct update_util_data *data, u64 time,
struct policy_dbs_info *policy_dbs = cdbs->policy_dbs;
u64 delta_ns, lst;

if (!cpufreq_can_do_remote_dvfs(policy_dbs->policy))
if (!cpufreq_this_cpu_can_update(policy_dbs->policy))
return;

/*
Expand Down
17 changes: 16 additions & 1 deletion drivers/cpuidle/governor.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
* This code is licenced under the GPL.
*/

#include <linux/mutex.h>
#include <linux/cpu.h>
#include <linux/cpuidle.h>
#include <linux/mutex.h>
#include <linux/pm_qos.h>

#include "cpuidle.h"

Expand Down Expand Up @@ -93,3 +95,16 @@ int cpuidle_register_governor(struct cpuidle_governor *gov)

return ret;
}

/**
* cpuidle_governor_latency_req - Compute a latency constraint for CPU
* @cpu: Target CPU
*/
int cpuidle_governor_latency_req(unsigned int cpu)
{
int global_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY);
struct device *device = get_cpu_device(cpu);
int device_req = dev_pm_qos_raw_read_value(device);

return device_req < global_req ? device_req : global_req;
}
10 changes: 1 addition & 9 deletions drivers/cpuidle/governors/ladder.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@

#include <linux/kernel.h>
#include <linux/cpuidle.h>
#include <linux/pm_qos.h>
#include <linux/jiffies.h>
#include <linux/tick.h>
#include <linux/cpu.h>

#include <asm/io.h>
#include <linux/uaccess.h>
Expand Down Expand Up @@ -69,16 +67,10 @@ static int ladder_select_state(struct cpuidle_driver *drv,
struct cpuidle_device *dev, bool *dummy)
{
struct ladder_device *ldev = this_cpu_ptr(&ladder_devices);
struct device *device = get_cpu_device(dev->cpu);
struct ladder_device_state *last_state;
int last_residency, last_idx = ldev->last_state_idx;
int first_idx = drv->states[0].flags & CPUIDLE_FLAG_POLLING ? 1 : 0;
int latency_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY);
int resume_latency = dev_pm_qos_raw_read_value(device);

if (resume_latency < latency_req &&
resume_latency != PM_QOS_RESUME_LATENCY_NO_CONSTRAINT)
latency_req = resume_latency;
int latency_req = cpuidle_governor_latency_req(dev->cpu);

/* Special case when user has set very strict latency requirement */
if (unlikely(latency_req == 0)) {
Expand Down
10 changes: 1 addition & 9 deletions drivers/cpuidle/governors/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

#include <linux/kernel.h>
#include <linux/cpuidle.h>
#include <linux/pm_qos.h>
#include <linux/time.h>
#include <linux/ktime.h>
#include <linux/hrtimer.h>
Expand All @@ -21,7 +20,6 @@
#include <linux/sched/loadavg.h>
#include <linux/sched/stat.h>
#include <linux/math64.h>
#include <linux/cpu.h>

/*
* Please note when changing the tuning values:
Expand Down Expand Up @@ -286,26 +284,20 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
bool *stop_tick)
{
struct menu_device *data = this_cpu_ptr(&menu_devices);
struct device *device = get_cpu_device(dev->cpu);
int latency_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY);
int latency_req = cpuidle_governor_latency_req(dev->cpu);
int i;
int first_idx;
int idx;
unsigned int interactivity_req;
unsigned int expected_interval;
unsigned long nr_iowaiters, cpu_load;
int resume_latency = dev_pm_qos_raw_read_value(device);
ktime_t delta_next;

if (data->needs_update) {
menu_update(drv, dev);
data->needs_update = 0;
}

if (resume_latency < latency_req &&
resume_latency != PM_QOS_RESUME_LATENCY_NO_CONSTRAINT)
latency_req = resume_latency;

/* Special case when user has set very strict latency requirement */
if (unlikely(latency_req == 0)) {
*stop_tick = false;
Expand Down
2 changes: 1 addition & 1 deletion include/linux/cpufreq.h
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ struct governor_attr {
size_t count);
};

static inline bool cpufreq_can_do_remote_dvfs(struct cpufreq_policy *policy)
static inline bool cpufreq_this_cpu_can_update(struct cpufreq_policy *policy)
{
/*
* Allow remote callbacks if:
Expand Down
1 change: 1 addition & 0 deletions include/linux/cpuidle.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ struct cpuidle_governor {

#ifdef CONFIG_CPU_IDLE
extern int cpuidle_register_governor(struct cpuidle_governor *gov);
extern int cpuidle_governor_latency_req(unsigned int cpu);
#else
static inline int cpuidle_register_governor(struct cpuidle_governor *gov)
{return 0;}
Expand Down
Loading

0 comments on commit 601ef1f

Please sign in to comment.