Re: [RFC RESEND 0/3] Add watermark support to devfreq

From: Tomeu Vizoso
Date: Mon Dec 08 2014 - 03:58:07 EST

On 8 December 2014 at 08:44, MyungJoo Ham <myungjoo.ham@xxxxxxxxxxx> wrote:
>> (Sorry for the spam. I am resending the series because I noted that
>> some of the email addresses were mistyped)
>> Currently main mechanism to implement scaling using devfreq is
>> polling and the device profile is free to set polling interval.
>> However, in many cases this approach is not optimal; We may
>> unnecessarily use CPU time to determine load on engine that
>> is idle most of time - or we may simply read load when we
>> already know that the device is busy.
>> In some cases a device itself has counters to track its activity
>> and possibility to raise interrupts when load goes above or below
>> certain threshold.
>> This series adds support for watermark events to devfreq and
>> introduces two example governors. The first patch adds two
>> callbacks to the device profile (for setting watermark) and
>> adds a new function call to devfreq that informs of crossed
>> watermark.
>> The added governors demonstrate usage of the new API. The first
>> governor (watermark simple) sets device to trigger low watermark
>> event when load goes below 10% and high watermark interrupt when
>> the load goes above 60%. Watermark active tries to keep load at
>> certain level and it actively sets thresholds based on the
>> frequency table in order get interrupts only when the load value
>> would affect to the current frequency in re-estimation.
> Hi Arto,
> Please let me start with somewhat naive high-level question:
> What do you mean by watermark in this context?
> Is it a product name of yours (interrupt-based PMU, I presume)?
> Or does watermark have another semantics that I am not aware of?
> Or do you really mean something like

The watermark term is borrowed here from queues. The high and low
watermarks define the boundaries within the load has to be contained.
If the load is above or below the watermarks, a more suitable
frequency has to be found.



> Other itching points include:
> - devfreq_watermark_event() was declared but has never been used.
> Who is supposed to call this function?
> - Is enum watermark_type supposed to be used out of /drivers/devfreq/* ?
> Otherwise, please move it inside /drivers/devfreq/governor.h
> (I guess it is to be used inside corresponding governors only)
> - Could you please watermark-specific interfaces (set_high/low_wmark) into
> its own public header file? (e.g., /include/linux/devfreq/governor_wmark.h)
> I think we can create another (governor_simpleondemand.h) in there as well
> in order to have threshold values configured by device drivers.
> Adding governor-specific configurations into devfreq.h seems not
> appropriate especially when we expect that we may need many different
> governors.
> OR..
> This seems that you can keep set_h/l_wmark functions exposed to
> drivers/devfreq/* only. Therefore, having /drivers/devfreq/governor_wmark.h
> should be sufficient as well, which should be more neat than the above.
> The callbacks are to be defined by the devfreq drivers, aren't they?
> - The event name, "DEVFREQ_GOV_WMARK", defined in governor.h, seems to be
> more appropriate if it is named "DEVFREQ_GOV_INTERNAL" as we won't need
> to define event names for each govornor's internal needs.
> OR.. for more generality,
> we may define a macro like:
> #define DEVFREQ_GOV_INTERNAL(value) ((0x1 << 31) | (value))
> #define GET_DEVFREQ_GOV_INTERNAL(event) ((event) & ~(0x1 << 31))
> - In general, I would love to see governors with minimal intervention on
> the framework core/main code, especially when it is not beneficial to
> other governors. Unlike cpufreq, we may contain many different types of
> devices in devfreq, which has the potential to accompany many different
> governors.
> Cheers,
> MyungJoo.
>> Arto Merilainen (1):
>> PM / devfreq: Add watermark active governor
>> Shridhar Rasal (2):
>> PM / devfreq: Add watermark events
>> PM / devfreq: Add watermark simple governor
>> drivers/devfreq/Kconfig | 18 +++
>> drivers/devfreq/Makefile | 2 +
>> drivers/devfreq/devfreq.c | 19 +++
>> drivers/devfreq/governor.h | 1 +
>> drivers/devfreq/governor_wmark_active.c | 276 ++++++++++++++++++++++++++++++++
>> drivers/devfreq/governor_wmark_simple.c | 245 ++++++++++++++++++++++++++++
>> include/linux/devfreq.h | 26 +++
>> 7 files changed, 587 insertions(+)
>> create mode 100644 drivers/devfreq/governor_wmark_active.c
>> create mode 100644 drivers/devfreq/governor_wmark_simple.c
>> --
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at