Skip to contentSkip to conversation

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

PATCH MyungJoo Ham 2 participants 2 messages Aug 3, 2015

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

Your patch introduces build errors if you try to compile governors as modules. Please fix it.

And..

Review

Quoted 4 lines
(quoted diff) +4 -0
+int devfreq_update_stats(struct devfreq *df)
+{
+	return df->profile->get_dev_status(df->dev.parent, &df->last_status);
+}

This seems a good candidate for a macro or a static inline function.

Modifications in governor_simpleondemand.c looks good.

Please add some explanations at the definition of devfreq_update_stats() as well in devfreq.c

Cheers,
MyungJoo.

#1 lore raw
Quoted 10 lines · MyungJoo Ham
Quoted 7 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]>

Your patch introduces build errors if you try to compile governors as modules. Please fix it.

Ok, with your suggestion to make devfreq_update_stats() a static inline function this will be solved. Sorry for that.

Quoted 6 lines

And..

Review

Quoted 4 lines
(quoted diff) +4 -0
+int devfreq_update_stats(struct devfreq *df)
+{
+	return df->profile->get_dev_status(df->dev.parent, &df->last_status);
+}

This seems a good candidate for a macro or a static inline function.

I'll turn it into a static inline function in <linux/devfreq.h>

Quoted 1 line

Modifications in governor_simpleondemand.c looks good.

Ok, so you are happy with this only working for that governor?

Quoted 2 lines

Please add some explanations at the definition of devfreq_update_stats() as well in devfreq.c

I'll add kerneldoc for it. Cheers,
Javi