根据网上的文档,kondemand
负责 CPU 扩展调节器。
kondemand 是一个内核线程,属于 cpufreq 子系统的 ondemand 调控器,它根据利用率统计信息更改系统的 p 状态。因此,它有助于电源管理。
所以我做了
# cpupower frequency-info --governors
analyzing CPU 0:
available cpufreq governors: ondemand userspace performance
# cpupower frequency-set --governor performance
Setting cpu: 0
Setting cpu: 1
Setting cpu: 2
Setting cpu: 3
Setting cpu: 4
Setting cpu: 5
Setting cpu: 6
Setting cpu: 7
Setting cpu: 8
Setting cpu: 9
Setting cpu: 10
Setting cpu: 11
Setting cpu: 12
Setting cpu: 13
Setting cpu: 14
Setting cpu: 15
Setting cpu: 16
Setting cpu: 17
Setting cpu: 18
Setting cpu: 19
Setting cpu: 20
Setting cpu: 21
Setting cpu: 22
Setting cpu: 23
Setting cpu: 24
Setting cpu: 25
Setting cpu: 26
Setting cpu: 27
Setting cpu: 28
Setting cpu: 29
Setting cpu: 30
Setting cpu: 31
然而,pidstat -wt
显示了大量的进程上下文切换kondemand
。
02:51:07 PM TGID TID cswch/s nvcswch/s Command
02:51:07 PM 2243 - 93.87 0.00 kondemand/0
02:51:07 PM - 2243 93.87 0.00 |__kondemand/0
02:51:07 PM 2244 - 95.29 0.00 kondemand/1
02:51:07 PM - 2244 95.29 0.00 |__kondemand/1
02:51:07 PM 2245 - 92.25 0.00 kondemand/2
02:51:07 PM - 2245 92.25 0.00 |__kondemand/2
02:51:07 PM 2246 - 94.72 0.00 kondemand/3
02:51:07 PM - 2246 94.72 0.00 |__kondemand/3
02:51:07 PM 2247 - 91.33 0.00 kondemand/4
02:51:07 PM - 2247 91.33 0.00 |__kondemand/4
02:51:07 PM 2248 - 94.49 0.00 kondemand/5
02:51:07 PM - 2248 94.49 0.00 |__kondemand/5
02:51:07 PM 2249 - 90.97 0.00 kondemand/6
02:51:07 PM - 2249 90.97 0.00 |__kondemand/6
02:51:07 PM 2250 - 94.54 0.00 kondemand/7
02:51:07 PM - 2250 94.54 0.00 |__kondemand/7
02:51:07 PM 2251 - 92.77 0.00 kondemand/8
02:51:07 PM - 2251 92.77 0.00 |__kondemand/8
02:51:07 PM 2252 - 94.92 0.00 kondemand/9
02:51:07 PM - 2252 94.92 0.00 |__kondemand/9
02:51:07 PM 2253 - 92.39 0.00 kondemand/10
02:51:07 PM - 2253 92.39 0.00 |__kondemand/10
02:51:07 PM 2254 - 95.18 0.00 kondemand/11
02:51:07 PM - 2254 95.18 0.00 |__kondemand/11
02:51:07 PM 2255 - 92.27 0.00 kondemand/12
02:51:07 PM - 2255 92.27 0.00 |__kondemand/12
02:51:07 PM 2256 - 95.18 0.00 kondemand/13
02:51:07 PM - 2256 95.18 0.00 |__kondemand/13
02:51:07 PM 2257 - 91.39 0.00 kondemand/14
02:51:07 PM - 2257 91.39 0.00 |__kondemand/14
02:51:07 PM 2258 - 95.08 0.00 kondemand/15
02:51:07 PM - 2258 95.08 0.00 |__kondemand/15
02:51:07 PM 2259 - 92.81 0.00 kondemand/16
02:51:07 PM - 2259 92.81 0.00 |__kondemand/16
02:51:07 PM 2260 - 95.03 0.00 kondemand/17
02:51:07 PM - 2260 95.03 0.00 |__kondemand/17
02:51:07 PM 2261 - 92.61 0.00 kondemand/18
02:51:07 PM - 2261 92.61 0.00 |__kondemand/18
02:51:07 PM 2262 - 95.23 0.00 kondemand/19
02:51:07 PM - 2262 95.23 0.00 |__kondemand/19
02:51:07 PM 2263 - 91.93 0.00 kondemand/20
02:51:07 PM - 2263 91.93 0.00 |__kondemand/20
02:51:07 PM 2264 - 95.36 0.00 kondemand/21
02:51:07 PM - 2264 95.36 0.00 |__kondemand/21
02:51:07 PM 2265 - 91.72 0.00 kondemand/22
02:51:07 PM - 2265 91.72 0.00 |__kondemand/22
02:51:07 PM 2266 - 95.12 0.00 kondemand/23
02:51:07 PM - 2266 95.12 0.00 |__kondemand/23
02:51:07 PM 2267 - 92.60 0.00 kondemand/24
02:51:07 PM - 2267 92.60 0.00 |__kondemand/24
02:51:07 PM 2268 - 95.14 0.00 kondemand/25
02:51:07 PM - 2268 95.14 0.00 |__kondemand/25
02:51:07 PM 2269 - 92.25 0.00 kondemand/26
02:51:07 PM - 2269 92.25 0.00 |__kondemand/26
02:51:07 PM 2270 - 95.49 0.00 kondemand/27
02:51:07 PM - 2270 95.49 0.00 |__kondemand/27
02:51:07 PM 2271 - 92.02 0.00 kondemand/28
02:51:07 PM - 2271 92.02 0.00 |__kondemand/28
02:51:07 PM 2272 - 95.07 0.00 kondemand/29
02:51:07 PM - 2272 95.07 0.00 |__kondemand/29
02:51:07 PM 2273 - 91.49 0.00 kondemand/30
02:51:07 PM - 2273 91.49 0.00 |__kondemand/30
02:51:07 PM 2274 - 95.32 0.00 kondemand/31
02:51:07 PM - 2274 95.32 0.00 |__kondemand/31
那么,问题是为什么进程会使用大量的上下文切换?