From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: MyungJoo Ham <myungjoo.ham@gmail.com>
Cc: linux-pm@lists.linux-foundation.org,
linux-kernel@vger.kernel.org, Len Brown <len.brown@intel.com>,
Pavel Machek <pavel@ucw.cz>,
"Greg Kroah-Hartman" <gregkh@suse.de>,
Kyungmin Park <kyungmin.park@samsung.com>,
Jiejing Zhang <kzjeef@gmail.com>, Colin Cross <ccross@google.com>,
Nishanth Menon <nm@ti.com>, Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH v3 2/3] PM / DEVFREQ: add example governors
Date: Thu, 7 Jul 2011 23:08:38 +0200 [thread overview]
Message-ID: <201107072308.38622.rjw@sisk.pl> (raw)
In-Reply-To: <CAJ0PZbQ0ENk-vEebqiD=DGHZVtswHQkPre8wUqM2vwR_r+V=Uw@mail.gmail.com>
On Monday, July 04, 2011, MyungJoo Ham wrote:
> On Mon, Jul 4, 2011 at 5:43 PM, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> > On Monday, July 04, 2011, MyungJoo Ham wrote:
> >> Hello,
> >>
> >> 2011/7/3 Rafael J. Wysocki <rjw@sisk.pl>:
> >> > Hi,
> >> >
> >> > On Friday, May 27, 2011, MyungJoo Ham wrote:
> >> >> Three CPUFREQ-like governors are provided as examples.
> >> >>
> >> >> powersave: use the lowest frequency possible. The user (device) should
> >> >> set the polling_ms as 0 because polling is useless for this governor.
> >> >>
> >> >> performance: use the highest freqeuncy possible. The user (device)
> >> >> should set the polling_ms as 0 because polling is useless for this
> >> >> governor.
> >> >>
> >> >> simple_ondemand: simplified version of CPUFREQ's ONDEMAND governor.
> >> >>
> >> >> When a user updates OPP entries (enable/disable/add), OPP framework
> >> >> automatically notifies DEVFREQ to update operating frequency
> >> >> accordingly. Thus, DEVFREQ users (device drivers) do not need to update
> >> >> DEVFREQ manually with OPP entry updates or set polling_ms for powersave
> >> >> , performance, or any other "static" governors.
> >> >>
> >> >> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
> >> >> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> >> []
> >> >> +
> >> >> + /* Set the desired frequency based on the load */
> >> >> + a = (unsigned long long) stat.busy_time * stat.current_frequency;
> >> >
> >> > What's the purpose of the conversion?
> >>
> >> Assuming that the work speed of a device is proportional to its
> >> frequency, it measures the amount of work done.
> >> It's time * work/time. For example, during the last 10 second, if the
> >> busy_time was 5 sec and frequency was 10MHz,
> >> it's "50M", which is same as 20MHz and 2.5 sec.
> >
> > I understand that, but my question was why you're doing a forced conversion
> > to (unsigned long long).
>
> Ah.. that was for the 64bit operations.
>
> Both busy_time and current_frequency are 32bit and current_frequency
> may be a big number.
>
> Thus, in order to get "freq" value without losing bits (e.g., if
> current_frequency = 1GHz and busy_time = 8000, we get an overflow
> without 64bit operations), I've inserted 64bit operations with the
> conversion. For the cosmetic reasons, it appears that "u64" looks
> better though.
You wouldn't need the explicit type casting if you did
a = stat.busy_time;
a *= stat.current_frequency;
Thanks,
Rafael
next prev parent reply other threads:[~2011-07-07 21:07 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-27 4:53 [PATCH v3 1/3] PM: Introduce DEVFREQ: generic DVFS framework with device-specific OPPs MyungJoo Ham
2011-05-27 4:53 ` [PATCH v3 2/3] PM / DEVFREQ: add example governors MyungJoo Ham
2011-07-02 21:58 ` Rafael J. Wysocki
2011-07-04 1:37 ` MyungJoo Ham
2011-07-04 8:43 ` Rafael J. Wysocki
2011-07-04 8:58 ` MyungJoo Ham
2011-07-07 21:08 ` Rafael J. Wysocki [this message]
2011-05-27 4:53 ` [PATCH v3 3/3] PM / DEVFREQ: add sysfs interface (including user tickling) MyungJoo Ham
2011-07-02 22:13 ` Rafael J. Wysocki
2011-07-04 7:15 ` MyungJoo Ham
2011-07-04 8:48 ` Rafael J. Wysocki
2011-05-28 8:57 ` [PATCH v3 1/3] PM: Introduce DEVFREQ: generic DVFS framework with device-specific OPPs Nishanth Menon
2011-05-30 5:03 ` MyungJoo Ham
2011-06-16 21:11 ` Rafael J. Wysocki
2011-07-02 21:30 ` Rafael J. Wysocki
2011-07-02 21:56 ` Rafael J. Wysocki
2011-07-04 8:34 ` MyungJoo Ham
2011-07-04 8:57 ` Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201107072308.38622.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=ccross@google.com \
--cc=gregkh@suse.de \
--cc=kyungmin.park@samsung.com \
--cc=kzjeef@gmail.com \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=myungjoo.ham@gmail.com \
--cc=nm@ti.com \
--cc=pavel@ucw.cz \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox