From e615617818feacd99e35995832b32df49e214b6c Mon Sep 17 00:00:00 2001 From: "Huang, Tao" Date: Mon, 18 May 2015 17:08:55 +0800 Subject: [PATCH] cpuquiet: PM QoS: Add max/min online cpus as PM QoS parameter Signed-off-by: Huang, Tao --- include/linux/pm_qos.h | 8 ++++++++ kernel/power/qos.c | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h index 5a95013905c8..7030558e8375 100644 --- a/include/linux/pm_qos.h +++ b/include/linux/pm_qos.h @@ -15,6 +15,10 @@ enum { PM_QOS_CPU_DMA_LATENCY, PM_QOS_NETWORK_LATENCY, PM_QOS_NETWORK_THROUGHPUT, +#ifdef CONFIG_CPUQUIET_FRAMEWORK + PM_QOS_MIN_ONLINE_CPUS, + PM_QOS_MAX_ONLINE_CPUS, +#endif /* insert new class ID */ PM_QOS_NUM_CLASSES, @@ -32,6 +36,10 @@ enum pm_qos_flags_status { #define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) #define PM_QOS_NETWORK_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) #define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE 0 +#ifdef CONFIG_CPUQUIET_FRAMEWORK +#define PM_QOS_MIN_ONLINE_CPUS_DEFAULT_VALUE 0 +#define PM_QOS_MAX_ONLINE_CPUS_DEFAULT_VALUE INT_MAX +#endif #define PM_QOS_DEV_LAT_DEFAULT_VALUE 0 #define PM_QOS_FLAG_NO_POWER_OFF (1 << 0) diff --git a/kernel/power/qos.c b/kernel/power/qos.c index 8703fc729fb4..0565679b574b 100644 --- a/kernel/power/qos.c +++ b/kernel/power/qos.c @@ -100,12 +100,43 @@ static struct pm_qos_object network_throughput_pm_qos = { .name = "network_throughput", }; +#ifdef CONFIG_CPUQUIET_FRAMEWORK +static BLOCKING_NOTIFIER_HEAD(min_online_cpus_notifier); +static struct pm_qos_constraints min_online_cpus_constraints = { + .list = PLIST_HEAD_INIT(min_online_cpus_constraints.list), + .target_value = PM_QOS_MIN_ONLINE_CPUS_DEFAULT_VALUE, + .default_value = PM_QOS_MIN_ONLINE_CPUS_DEFAULT_VALUE, + .type = PM_QOS_MAX, + .notifiers = &min_online_cpus_notifier, +}; +static struct pm_qos_object min_online_cpus_pm_qos = { + .constraints = &min_online_cpus_constraints, + .name = "min_online_cpus", +}; + +static BLOCKING_NOTIFIER_HEAD(max_online_cpus_notifier); +static struct pm_qos_constraints max_online_cpus_constraints = { + .list = PLIST_HEAD_INIT(max_online_cpus_constraints.list), + .target_value = PM_QOS_MAX_ONLINE_CPUS_DEFAULT_VALUE, + .default_value = PM_QOS_MAX_ONLINE_CPUS_DEFAULT_VALUE, + .type = PM_QOS_MIN, + .notifiers = &max_online_cpus_notifier, +}; +static struct pm_qos_object max_online_cpus_pm_qos = { + .constraints = &max_online_cpus_constraints, + .name = "max_online_cpus", +}; +#endif static struct pm_qos_object *pm_qos_array[] = { &null_pm_qos, &cpu_dma_pm_qos, &network_lat_pm_qos, - &network_throughput_pm_qos + &network_throughput_pm_qos, +#ifdef CONFIG_CPUQUIET_FRAMEWORK + &min_online_cpus_pm_qos, + &max_online_cpus_pm_qos, +#endif }; static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf, -- 2.34.1