linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Chan <mike@android.com>
To: Vitaly Wool <vitalywool@gmail.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>,
	Greg Kroah-Hartman <gregkh@suse.de>,
	Jesse Barnes <jbarnes@virtuousgeek.org>,
	linux-kernel@vger.kernel.org,
	linux-pm@lists.linux-foundation.org,
	Arjan van de Ven <arjan@infradead.org>,
	Matthew Garrett <mjg@redhat.com>, Len Brown <len.brown@intel.com>,
	Jacob Pan <jacob.jun.pan@linux.intel.com>,
	Oleg Nesterov <oleg@redhat.com>,
	Liam Girdwood <lrg@slimlogic.co.uk>,
	linux-omap@vger.kernel.org,
	Linus Walleij <linus.walleij@stericsson.com>,
	Daniel Walker <dwalker@codeaurora.org>,
	tytso@mit.edu, Brian Swetland <swetland@google.com>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Geoff Smith <geoffx.smith@intel.com>, Tejun Heo <tj@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Wu Fengguang <fengguang.wu@intel.com>
Subject: Re: [linux-pm] [PATCH 0/8] Suspend block api (version 6)
Date: Mon, 17 May 2010 14:04:20 -0700	[thread overview]
Message-ID: <AANLkTimsPpdWEEuwcsJ2XT7fHO8h-EyzYvR06X5EJ-T5@mail.gmail.com> (raw)
In-Reply-To: <AANLkTikEIuVEhJXSx4kP4sGMP8LBepuJI5jBjqSxoH7F@mail.gmail.com>

On Mon, May 17, 2010 at 1:17 PM, Vitaly Wool <vitalywool@gmail.com> wrote:
> On Mon, May 17, 2010 at 10:07 PM, Mike Chan <mike@android.com> wrote:
>> On Mon, May 17, 2010 at 12:27 PM, Vitaly Wool <vitalywool@gmail.com> wrote:
>>> On Mon, May 17, 2010 at 6:12 PM, Kevin Hilman
>>> <khilman@deeprootsystems.com> wrote:
>>>
>>>>> and #2, the battery lifetime on the N770 and N800 (both of which I have)
>>>>> is **appalling** **bad**.
>>>>
>>>> Appalling bad compared to what?
>>>>
>>>> What's probably more interesting in terms of rough comparisons is
>>>> comparing similar devices with and without opportunistic suspend.  The
>>>> Nokia n900 (maemo) and the Moto Droid (android) use the same SoC (TI
>>>> OMAP3) and roughly the same kernel (2.6.2[89], although both are
>>>> heavily patched from mainline.)
>>>>
>>>> The n900 *never* suspends.  It only uses dynamic PM + CPUidle.
>>>> The droid uses opportunistic suspend (as well as dynamic PM + CPUidle)
>>>>
>>>> I don't know of any more objective comparison of the two, but as a
>>>> user of both devices I can say that the active usage is basically the
>>>> same (around a day) and the idle use is similar as well, even though
>>>> the Droid has a slightly bigger battery (1400 mAh vs. 1320 mAh.)  My
>>>> own usage suggests the n900 is a bit better in idle time, but I have
>>>> not done any measuring or objective tests.  I'm guessing the
>>>> difference is probably because the Droid does not use the deepest
>>>> off-mode power states either in idle or suspend (IIRC) where the n900
>>>> does.  I suspect that if both were using off-mode and had the same
>>>> battery, these differences would go away.
>>>>
>>
>> Although both are OMAP3430 and run 2.6.29 you cannot compare the N900
>> and Droid's perceived user battery life to one another to evaluate
>> opportunistic suspend. There are many factors uncounted for such as:
>> network reception, screen brightness (and size), button back-light,
>> keyboard back-light, modem stack (CDMA vs UMTS). Also the difference
>> in uerspace.
>>
>>>> While this is not really a scientific comparison, it at least gives a
>>>> rough idea.  If using opportunistic suspend was adding noticably
>>>> better battery life, I think this would be a different discussion.
>>>


Okay, I measured with and without using the scientific method. With a
1390mAh battery, if you set your device in airplane mode you will get
435.7 hours of standby vs 397.14 hours of standby.

Is this data sufficient for a "different discussion" now?

>>> Exactly. The point is, opportunistic suspend doesn't in fact add any
>>> value compared to dynamic PM + CPUIdle. It only produces some false
>>> impression that one can handle power management right without using
>>> dynamic PM. And this false impression is the cause for many really
>>> ugly designs (like, for instance, 15 minutes touchscreen inactivity
>>> delay before forcibly shutting down the wireless, as it's done in
>>> stock Android framework).
>>>
>>
>> Opportunistic suspend is an extension to the current suspend model,
>> not a replacement dynamic / run-time PM. If you can replace good old
>> suspend then this would be a different story.
>
> Yes, but what does it extend? What aspect it makes the current suspend
> model better in?
>

Network configuration and cell reception is a big factor here. You can
easily get +4-8mA on the original numbers I gave below, so its large
enough to skew your "perceived" power usage.

>> As you mention, Droid uses opportunistic suspend + dynamic pm +
>> cpuidle + freq. So I decided to do some measurements on a Droid using
>> our 2.9.32 kernel
>> (http://android.git.kernel.org/?p=kernel/omap.git;a=summary). For a
>> little better apples to apples comparison.
>>
>> Droid (idle system, airplane mode, screen off, 3 min interval):
>> measured average current
>> - with opportunity suspend: 3.19mA
>> - without opportunistic suspend: 3.5mA
>>
>> Stock userspace build, all I did was replace the kernel. We are
>> hitting retention on idle as well as suspend for omap (instead of full
>> off-mode).
>
> That's implementation specific. If CPUIdle implemented CPU deep sleep,
> I bet you would see different figures.
>

The important part here is not the absolute value, but how they
compare relatively. If I added off-mode support then I the averages
would both drop, but they would not be the same (key point).

I simply wanted show with real numbers that there is a difference in
opportunistic suspend and without. Instead of purely hypothesizing
that there is no power benefit from using opportunistic suspend.


>> Also, your point about wifi, the 15 min timeout is in the framework
>> and is configurable in the code and via UI, nothing to do with kernel,
>> opportunistic suspend or run time suspend.
>
> You don't quite get it :) This should NOT at all be timeout driven.
> This should be activity driven or constraint driven which perfectly
> fits into the runtime PM paradigm but is in no way cleanly implemented
> within the "pure" Android PM.
>

I admit, our timeout approach is a bit hacky, but there is method for
the madness.

In order to properly determine when you should turn off wifi for
"perfect" power management, you need to know a few things. 1) When, in
the 'future' is the user going to turn on the screen. 2) How many
network packets will be sent  to the device while the screen is off.

Some of these factors are Android specific, in particular the device
always has a TCP connection open to google servers. So switching from
WIFI -> 3G for example causes us to generate extra network traffic as
we try to establish our SSL connection to google servers. Likewise
this cost is paid when moving from 3G -> wifi.

Its *really* hard to predict the future, so we use this timeout based
off of various heuristics, usability studies and power measurements.

So we attempt to minimize excessive network io for both power reasons
and network reasons (ie: cell carriers), as well as user experience
(latency to connect / disconnect to a wifi access point).

However we are not talking about kernel power management here, we are
talking about Android policy that might be dedicated by various OEM /
carrier requirements and user experience. I wouldn't necessarily go so
far and say its flat out "wrong" what we are doing, but I do feel that
it is Android specific enough that having our own policy for this is
valid.

If you feel strongly against this, I will be more than happy to dive
into details in an android specific thread off lkml.

-- Mike

> Thanks,
>   Vitaly
>

  reply	other threads:[~2010-05-17 21:04 UTC|newest]

Thread overview: 186+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1272667021-21312-1-git-send-email-arve@android.com>
2010-05-13  3:35 ` [linux-pm] [PATCH 0/8] Suspend block api (version 6) Paul Walmsley
2010-05-13 12:17   ` Matthew Garrett
2010-05-13 17:33     ` Daniel Walker
2010-05-13 18:17       ` Brian Swetland
2010-05-13 18:25         ` Daniel Walker
2010-05-13 18:36           ` [linux-pm] " Matthew Garrett
2010-05-13 18:59             ` Daniel Walker
2010-05-13 19:11               ` Matthew Garrett
2010-05-13 19:36                 ` Daniel Walker
2010-05-13 19:48                   ` Matthew Garrett
2010-05-13 21:11                     ` Rafael J. Wysocki
2010-05-13 21:16                       ` Daniel Walker
2010-05-13 21:27                         ` Rafael J. Wysocki
2010-05-13 21:33                           ` Daniel Walker
2010-05-13 21:36                             ` Tony Lindgren
2010-05-13 21:54                               ` Rafael J. Wysocki
2010-05-13 21:46                             ` Greg KH
2010-05-13 22:27                               ` Mark Brown
2010-05-13 22:45                                 ` Greg KH
2010-05-14  0:03                                   ` Mark Brown
2010-05-13 22:46                                 ` Rafael J. Wysocki
2010-05-13 23:36                                   ` Mark Brown
2010-05-13 23:48                                     ` [linux-pm] " Brian Swetland
2010-05-14  0:29                                       ` Mark Brown
2010-05-13 22:33                               ` Woodruff, Richard
2010-05-13 22:46                                 ` Greg KH
2010-05-13 23:06                                   ` [linux-pm] " Arve Hjønnevåg
2010-05-13 23:28                                   ` Brian Swetland
2010-05-14 16:47                               ` Daniel Walker
2010-05-13 14:16   ` Alan Stern
2010-05-13 19:17     ` Tony Lindgren
2010-05-13 19:25       ` Matthew Garrett
2010-05-13 19:42         ` Tony Lindgren
2010-05-13 19:53           ` Matthew Garrett
2010-05-13 20:00             ` Tony Lindgren
2010-05-13 20:08               ` Matthew Garrett
2010-05-13 20:23                 ` Tony Lindgren
2010-05-13 20:34                   ` Matthew Garrett
2010-05-13 21:10                     ` Tony Lindgren
2010-05-13 21:21                       ` Matthew Garrett
2010-05-13 21:34                         ` Tony Lindgren
2010-05-15 19:54                           ` Matthew Garrett
2010-05-13 21:21                     ` Rafael J. Wysocki
2010-05-13 21:25                       ` Tony Lindgren
2010-05-13 21:56                         ` Rafael J. Wysocki
2010-05-14 20:41                           ` Kevin Hilman
2010-05-14 21:25                             ` Rafael J. Wysocki
2010-05-14 21:40                             ` Kevin Hilman
2010-05-14 21:50                               ` Rafael J. Wysocki
2010-05-14 22:45                                 ` [linux-pm] " Kevin Hilman
2010-05-14 22:59                                   ` Brian Swetland
2010-05-15  2:58                                     ` Alan Stern
2010-05-15  3:40                                       ` Brian Swetland
2010-05-15 21:19                                         ` Alan Stern
2010-05-17 15:40                                           ` Kevin Hilman
2010-05-17 17:04                                             ` James Bottomley
2010-05-17 17:47                                               ` Felipe Balbi
2010-05-17 17:58                                                 ` Matthew Garrett
2010-05-17 18:16                                                   ` Felipe Balbi
2010-05-17 17:59                                                 ` James Bottomley
2010-05-17 18:12                                                   ` Felipe Balbi
2010-05-17 18:26                                                     ` Brian Swetland
2010-05-17 18:39                                                       ` Felipe Balbi
2010-05-17 18:45                                                         ` Brian Swetland
2010-05-17 20:22                                                           ` Rafael J. Wysocki
2010-05-17 18:45                                                         ` Mark Brown
2010-05-17 18:47                                                         ` Mike Chan
2010-05-17 19:24                                                     ` James Bottomley
2010-05-17 19:38                                                       ` Felipe Balbi
2010-05-17 19:39                                                         ` Felipe Balbi
2010-05-17 19:49                                                           ` James Bottomley
2010-05-18  6:40                                                             ` Felipe Balbi
2010-05-18 13:59                                                               ` James Bottomley
2010-05-19  6:59                                                                 ` Felipe Balbi
2010-05-19 20:42                                                                   ` Rafael J. Wysocki
2010-05-20  4:49                                                                     ` Felipe Balbi
2010-05-20 11:27                                                                       ` Vladimir Pantelic
2010-05-20 11:29                                                                         ` Felipe Balbi
2010-05-20 17:40                                                                         ` David Brownell
2010-05-20 18:50                                                                           ` Felipe Balbi
2010-05-20 23:08                                                                             ` David Brownell
2010-05-20  5:15                                                                   ` Florian Mickler
2010-05-20  8:57                                                                     ` Felipe Balbi
2010-05-20  8:57                                                                       ` Felipe Balbi
2010-05-20 10:05                                                                       ` [linux-pm] " Florian Mickler
2010-05-20 10:15                                                                         ` Felipe Balbi
2010-05-17 18:54                                                   ` Kevin Hilman
2010-05-17 17:57                                               ` Daniel Walker
2010-05-15 20:14                                   ` Rafael J. Wysocki
2010-05-16 19:44                                     ` Mark Brown
2010-05-13 22:24                         ` tytso
2010-05-13 20:36                   ` Daniel Walker
2010-05-14 16:06                 ` Kevin Hilman
2010-05-24 21:25                 ` Pavel Machek
2010-05-13 21:41           ` Alan Stern
2010-05-13 21:54             ` Tony Lindgren
2010-05-13 22:07               ` Rafael J. Wysocki
2010-05-13 22:26           ` Arve Hjønnevåg
2010-05-13 21:14       ` Rafael J. Wysocki
2010-05-13 21:31         ` Tony Lindgren
2010-05-13 21:57           ` Rafael J. Wysocki
2010-05-13 21:37       ` Alan Stern
2010-05-13 21:47         ` Tony Lindgren
2010-05-13 22:01           ` Alan Stern
2010-05-13 22:08             ` Tony Lindgren
2010-05-13 22:28               ` Rafael J. Wysocki
2010-05-15  2:35                 ` Alan Stern
2010-05-15  4:04                   ` Arve Hjønnevåg
2010-05-13 22:04           ` [linux-pm] " Rafael J. Wysocki
2010-05-14  3:25           ` Magnus Damm
2010-05-14 16:18             ` Kevin Hilman
2010-05-15  2:47             ` Alan Stern
2010-05-24 21:24     ` Pavel Machek
     [not found] ` <1272667021-21312-2-git-send-email-arve@android.com>
2010-05-13 19:01   ` [PATCH 1/8] PM: Add suspend block api Paul Walmsley
2010-05-14 20:05     ` Paul Walmsley
     [not found] ` <87wrvl5479.fsf@deeprootsystems.com>
     [not found]   ` <20100503180741.GB2098@rakim.wolfsonmicro.main>
2010-05-14 17:39     ` [PATCH 0/8] Suspend block api (version 6) Paul Walmsley
     [not found]     ` <201005032318.35383.rjw@sisk.pl>
2010-05-14 20:02       ` Paul Walmsley
     [not found]       ` <87sk68r1zh.fsf@deeprootsystems.com>
     [not found]         ` <s2qd6200be21005031709r28420f0ezf3cf286517ee9114@mail.gmail.com>
2010-05-14 20:27           ` Paul Walmsley
2010-05-14 22:18             ` Arve Hjønnevåg
2010-05-15  2:25               ` Alan Stern
2010-05-15  4:02                 ` Arve Hjønnevåg
2010-05-15 21:25                   ` Alan Stern
2010-05-17  4:54                     ` Arve Hjønnevåg
2010-05-18  2:26               ` Paul Walmsley
2010-05-18  3:21                 ` Arve Hjønnevåg
2010-05-18  7:03                   ` Henrik Rydberg
2010-05-18 19:39                     ` Rafael J. Wysocki
2010-05-25  9:41                   ` Paul Walmsley
2010-05-25 23:08                     ` Arve Hjønnevåg
2010-05-26  7:23                       ` Linus WALLEIJ
2010-05-26 16:01                         ` Alan Stern
2010-05-27  7:46                           ` Linus WALLEIJ
2010-05-27  8:04                             ` Florian Mickler
2010-05-27  8:40                             ` Arve Hjønnevåg
2010-05-27 15:33                             ` Alan Stern
2010-05-28 11:54                               ` Linus WALLEIJ
2010-05-20 23:37                 ` David Brownell
2010-05-25 16:51               ` Dmitry Torokhov
2010-05-25 18:25                 ` Alan Stern
2010-05-25 18:33                   ` Dmitry Torokhov
2010-05-25 22:05                     ` Arve Hjønnevåg
2010-05-25 22:28                       ` Dmitry Torokhov
     [not found]         ` <20100504004338.GA22678@srcf.ucam.org>
2010-05-14 20:36           ` Paul Walmsley
     [not found]   ` <20100503215028.GB18910@srcf.ucam.org>
2010-05-14 20:20     ` Paul Walmsley
2010-05-14 20:32       ` Matthew Garrett
2010-05-14 22:32         ` Kevin Hilman
2010-05-14 22:37           ` Arve Hjønnevåg
2010-05-15 19:47             ` Rafael J. Wysocki
2010-05-15 19:55               ` Brian Swetland
2010-05-15 23:51                 ` Rafael J. Wysocki
2010-05-16  0:31                   ` Brian Swetland
2010-05-14 23:15           ` tytso
2010-05-15 19:52             ` Rafael J. Wysocki
2010-05-16 19:01               ` Mark Brown
2010-05-18  1:39               ` Paul Walmsley
2010-05-18  1:55                 ` Matthew Garrett
2010-05-19 16:17                   ` Paul Walmsley
2010-05-19 16:25                     ` Matthew Garrett
2010-05-21 16:51                       ` Paul Walmsley
2010-05-21 17:01                         ` Paul Walmsley
2010-05-21 17:09                         ` Matthew Garrett
2010-05-17 16:12             ` Kevin Hilman
2010-05-17 19:27               ` Vitaly Wool
2010-05-17 19:34                 ` Matthew Garrett
2010-05-17 19:50                   ` Daniel Walker
2010-05-17 20:00                     ` Matthew Garrett
2010-05-17 20:02                     ` Brian Swetland
2010-05-17 20:53                   ` Linus WALLEIJ
2010-05-17 21:06                     ` Matthew Garrett
2010-05-17 21:16                       ` Linus WALLEIJ
2010-05-17 21:24                         ` Matthew Garrett
2010-05-17 21:29                           ` Daniel Walker
2010-05-17 21:35                             ` Matthew Garrett
2010-05-17 21:39                               ` Daniel Walker
2010-05-17 21:27                   ` Kevin Hilman
2010-05-17 21:34                     ` Matthew Garrett
2010-05-17 22:56                       ` Kevin Hilman
2010-05-17 21:36                     ` Brian Swetland
2010-05-18  2:40                       ` tytso
2010-05-17 20:07                 ` [linux-pm] " Mike Chan
2010-05-17 20:17                   ` Vitaly Wool
2010-05-17 21:04                     ` Mike Chan [this message]
2010-05-17 22:55                   ` Kevin Hilman
2010-05-17 23:04                     ` Brian Swetland
2010-05-17 20:15               ` Rafael J. Wysocki
2010-05-30 12:21               ` tytso

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=AANLkTimsPpdWEEuwcsJ2XT7fHO8h-EyzYvR06X5EJ-T5@mail.gmail.com \
    --to=mike@android.com \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@infradead.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=dwalker@codeaurora.org \
    --cc=fengguang.wu@intel.com \
    --cc=geoffx.smith@intel.com \
    --cc=gregkh@suse.de \
    --cc=jacob.jun.pan@linux.intel.com \
    --cc=jbarnes@virtuousgeek.org \
    --cc=khilman@deeprootsystems.com \
    --cc=len.brown@intel.com \
    --cc=linus.walleij@stericsson.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=lrg@slimlogic.co.uk \
    --cc=mjg@redhat.com \
    --cc=oleg@redhat.com \
    --cc=swetland@google.com \
    --cc=tj@kernel.org \
    --cc=tytso@mit.edu \
    --cc=vitalywool@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).