Skip to contentSkip to conversation

PM / devfreq: cache the last call to get_dev_status()

PATCH MyungJoo Ham 2 participants 2 messages Jul 17, 2015 – Jul 22, 2015

lore
Share & tools
lore
#0 lore raw
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]>

---

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 for busy_time and total_time
2) Make core devfreq call get_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 call get_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.

#1 lore raw

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]>

---

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 for busy_time and total_time
2) Make core devfreq call get_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 call get_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(-)

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