Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'pm-qos'

* pm-qos:
PM / QoS: Add PM_QOS_MEMORY_BANDWIDTH class

+33 -3
+3 -1
Documentation/power/pm_qos_interface.txt
··· 5 5 one of the parameters. 6 6 7 7 Two different PM QoS frameworks are available: 8 - 1. PM QoS classes for cpu_dma_latency, network_latency, network_throughput. 8 + 1. PM QoS classes for cpu_dma_latency, network_latency, network_throughput, 9 + memory_bandwidth. 9 10 2. the per-device PM QoS framework provides the API to manage the per-device latency 10 11 constraints and PM QoS flags. 11 12 ··· 14 13 * latency: usec 15 14 * timeout: usec 16 15 * throughput: kbs (kilo bit / sec) 16 + * memory bandwidth: mbs (mega bit / sec) 17 17 18 18 19 19 1. PM QoS framework
+4 -1
include/linux/pm_qos.h
··· 15 15 PM_QOS_CPU_DMA_LATENCY, 16 16 PM_QOS_NETWORK_LATENCY, 17 17 PM_QOS_NETWORK_THROUGHPUT, 18 + PM_QOS_MEMORY_BANDWIDTH, 18 19 19 20 /* insert new class ID */ 20 21 PM_QOS_NUM_CLASSES, ··· 33 32 #define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) 34 33 #define PM_QOS_NETWORK_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) 35 34 #define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE 0 35 + #define PM_QOS_MEMORY_BANDWIDTH_DEFAULT_VALUE 0 36 36 #define PM_QOS_RESUME_LATENCY_DEFAULT_VALUE 0 37 37 #define PM_QOS_LATENCY_TOLERANCE_DEFAULT_VALUE 0 38 38 #define PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT (-1) ··· 71 69 enum pm_qos_type { 72 70 PM_QOS_UNITIALIZED, 73 71 PM_QOS_MAX, /* return the largest value */ 74 - PM_QOS_MIN /* return the smallest value */ 72 + PM_QOS_MIN, /* return the smallest value */ 73 + PM_QOS_SUM /* return the sum */ 75 74 }; 76 75 77 76 /*
+26 -1
kernel/power/qos.c
··· 105 105 }; 106 106 107 107 108 + static BLOCKING_NOTIFIER_HEAD(memory_bandwidth_notifier); 109 + static struct pm_qos_constraints memory_bw_constraints = { 110 + .list = PLIST_HEAD_INIT(memory_bw_constraints.list), 111 + .target_value = PM_QOS_MEMORY_BANDWIDTH_DEFAULT_VALUE, 112 + .default_value = PM_QOS_MEMORY_BANDWIDTH_DEFAULT_VALUE, 113 + .no_constraint_value = PM_QOS_MEMORY_BANDWIDTH_DEFAULT_VALUE, 114 + .type = PM_QOS_SUM, 115 + .notifiers = &memory_bandwidth_notifier, 116 + }; 117 + static struct pm_qos_object memory_bandwidth_pm_qos = { 118 + .constraints = &memory_bw_constraints, 119 + .name = "memory_bandwidth", 120 + }; 121 + 122 + 108 123 static struct pm_qos_object *pm_qos_array[] = { 109 124 &null_pm_qos, 110 125 &cpu_dma_pm_qos, 111 126 &network_lat_pm_qos, 112 - &network_throughput_pm_qos 127 + &network_throughput_pm_qos, 128 + &memory_bandwidth_pm_qos, 113 129 }; 114 130 115 131 static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf, ··· 146 130 /* unlocked internal variant */ 147 131 static inline int pm_qos_get_value(struct pm_qos_constraints *c) 148 132 { 133 + struct plist_node *node; 134 + int total_value = 0; 135 + 149 136 if (plist_head_empty(&c->list)) 150 137 return c->no_constraint_value; 151 138 ··· 158 139 159 140 case PM_QOS_MAX: 160 141 return plist_last(&c->list)->prio; 142 + 143 + case PM_QOS_SUM: 144 + plist_for_each(node, &c->list) 145 + total_value += node->prio; 146 + 147 + return total_value; 161 148 162 149 default: 163 150 /* runtime check for not using enum */