PM / devfreq: cache the last call to get_dev_status()
Quoted 21 lines
The return value of
get_dev_status()can be reused. Cache it so that other parts of the kernel can reuse it instead of having to call the same function again.Cc MyungJoo Ham <[email protected]>Cc Kyungmin Park <[email protected]>Signed-off-by Javi Merino <[email protected]>---
This patch tries to let multiple components. To summarize the discussion in v1[1] I can think of three alternatives:
1) Change
get_dev_status()to return absolute values forbusy_timeandtotal_time
2) Make core devfreq callget_dev_status()periodically (for example, before calling the governor) and all the entities that want access can do so via a pointer in devfreq
3) Make the simple ondemand governor callget_dev_status()periodically and cache it, forcing all the other entities to rely on that governor being active
Quoted 9 lines
[1] http://thread.gmane.org/gmane.linux.power-management.general/61936/focus=61993
This patch implements option 3)
drivers/devfreq/devfreq.c | 5 +++++ drivers/devfreq/governor_simpleondemand.c | 33 +++++++++++++++++-------------- include/linux/devfreq.h | 7 +++++++ 3 files changed, 30 insertions(+), 15 deletions(-)
Dear Javi,
Another question has risen as seeing Chanwoo's RFC patches, which have a similar objective to different devices with much less intervention:
[RFC PATCH 0/2] thermal: Add generic devfreq cooling device
https://lkml.org/lkml/2015/7/16/334
(This patch set also requires updates as it appears not to use opp notifiers properly, but it shows the direction on how to implement thermal/qos inputs to devfreq devices)
Can't you simply use OPP's disable/enable functions and let devfreq automatically update itself accordingly? It simplifies your codes as well especially if you put your possible frequencies to DT.
Cheers,
MyungJoo
ps. Chanwoo, I will comment on your patches on the usage of opp-notifiers as well.
Hi MyungJoo,
Quoted 41 lines · MyungJoo Ham
Quoted 21 lines
The return value of
get_dev_status()can be reused. Cache it so that other parts of the kernel can reuse it instead of having to call the same function again.Cc MyungJoo Ham <[email protected]>Cc Kyungmin Park <[email protected]>Signed-off-by Javi Merino <[email protected]>---
This patch tries to let multiple components. To summarize the discussion in v1[1] I can think of three alternatives:
1) Change
get_dev_status()to return absolute values forbusy_timeandtotal_time
2) Make core devfreq callget_dev_status()periodically (for example, before calling the governor) and all the entities that want access can do so via a pointer in devfreq
3) Make the simple ondemand governor callget_dev_status()periodically and cache it, forcing all the other entities to rely on that governor being activeQuoted 9 lines
[1] http://thread.gmane.org/gmane.linux.power-management.general/61936/focus=61993
This patch implements option 3)
drivers/devfreq/devfreq.c | 5 +++++ drivers/devfreq/governor_simpleondemand.c | 33 +++++++++++++++++-------------- include/linux/devfreq.h | 7 +++++++ 3 files changed, 30 insertions(+), 15 deletions(-)Another question has risen as seeing Chanwoo's RFC patches, which have a similar objective to different devices with much less intervention:
[RFC PATCH 0/2] thermal: Add generic devfreq cooling device
https://lkml.org/lkml/2015/7/16/334
(This patch set also requires updates as it appears not to use opp notifiers properly, but it shows the direction on how to implement thermal/qos inputs to devfreq devices)
Quoted 4 lines
Can't you simply use OPP's disable/enable functions and let devfreq automatically update itself accordingly? It simplifies your codes as well especially if you put your possible frequencies to DT.
Ok, we can use OPP enable/disable to modify the available OPPs and let devfreq take the appropriate decision. I'll send a v3 next week.
Still, the question of how to let multiple components access get_dev_status() is still open. Have you had time to consider it?
Cheers,
Javi