FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Fedora Development

 
 
LinkBack Thread Tools
 
Old 07-14-2008, 09:57 PM
Ulrich Drepper
 
Default process wakeups

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

One of the worst problems wrt energy savings we have today are all the
wakeups processes request. This is not just an issue for laptops, it
relevant everywhere.

To see the size of the problem run the attached systemtap script. On my
laptop I see the following output (47 secs runtime):

uid | poll select epoll itimer futex nanosle signal| process
29799 |15941 7971 0 0 0 0 0| npviewer.bin
29841 | 253 0 0 0 1531 0 0| thunderbird-bin
3017 | 447 0 0 0 0 0 0| pulseaudio
2467 | 76 0 0 0 0 0 0| hald
2471 | 8 0 0 0 0 0 0| hald-runner
2620 | 58 0 0 0 0 0 0| NetworkManager
13174 | 214 0 0 0 0 0 0| stapio
3044 | 48 0 0 0 0 0 0| gnome-panel
9115 | 16 0 0 0 0 0 0| nm-vpnc-service
3112 | 32 0 0 0 0 0 0| gpk-update-icon
3108 | 24 0 0 0 0 0 0| nm-applet
3052 | 274 0 0 1 0 0 0| gnome-terminal
3115 | 29 0 0 0 0 0 0| gnome-power-man
3055 | 16 0 0 0 0 0 0| bluetooth-apple
3093 | 16 0 0 0 0 0 0| krb5-auth-dialo
2633 | 16 0 0 0 0 0 0| gdm-binary
2724 | 16 0 0 0 0 0 0| gdm-simple-slav
2630 | 16 0 0 0 0 0 0| nm-system-setti
2470 | 16 0 0 0 0 0 0| console-kit-dae
2385 | 16 0 0 0 0 0 0| avahi-daemon
2397 | 16 0 0 0 0 0 0| libvirtd
2725 | 63 214 0 4 0 0 0| Xorg
2150 | 42 0 0 0 0 0 0| setroubleshootd
3010 | 47 0 0 0 0 0 0| gnome-settings-
3040 | 111 0 0 0 0 0 0| metacity
3526 | 37 0 0 0 0 0 0| notification-da
3085 | 49 0 0 0 0 0 0| wnck-applet
3043 | 50 0 0 0 0 0 0| gnome-screensav
3042 | 26 0 0 0 0 0 0| nautilus
3050 | 8 0 0 0 0 0 0| evince
9120 | 0 5 0 0 0 0 0| vpnc
3342 | 11 0 0 0 0 0 0| clock-applet
3329 | 0 6 0 0 0 0 0| pam_timestamp_c
2337 | 0 7 0 0 0 0 0| sendmail
2132 | 0 0 0 0 33 0 0| automount
2958 | 0 3 0 0 0 0 0| ssh-agent
2118 | 1 0 0 0 0 0 0| dbus-daemon
5732 | 1 0 0 0 0 0 0| gnome-vfs-daemo
29394 | 68 131 0 0 65 0 0| firefox
2105 | 1 0 0 0 0 0 0| audispd
1979 | 0 1 0 0 0 0 0| rsyslogd


As you can see, not all programs are equally bad and proprietary ones
(here: flash) are the worst.

Still, since the script records wakeups due to timeouts almost all
mentions on this list are bad. Programs should be woken based on
events. They shouldn't poll data (which is what usually happens after a
timeout).

I would hope the package maintainers can find some time and look at the
issues. Maybe at least document them in a BZ. I might try to do the
latter myself but given the large number of packages involved I'll most
likely be able to cover just a few packages. IMO it should be a release
criteria that a program does use polling.

- --
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iEYEARECAAYFAkh7y9oACgkQ2ijCOnn/RHTW6wCfWzYOn3AvjLvJ5mwWjSZwr8tX
Z84An2YYvqd9f2fkPGenE5uhDDdsan3y
=VWLu
-----END PGP SIGNATURE-----
# Copyright (C) 2008 Red Hat, Inc.
# Written by Ulrich Drepper <drepper@redhat.com>
global process
global poll_timeouts
global epoll_timeouts
global select_timeouts
global itimer_timeouts
global nanosleep_timeouts
global futex_timeouts
global signal_timeouts

probe kernel.function("do_sys_poll").return {
if ($return == 0) {
p = pid()
if (!(p in process))
process[p] = execname()
poll_timeouts[p]++
}
}

probe kernel.function("do_select").return {
if ($return == 0) {
p = pid()
if (!(p in process))
process[p] = execname()
select_timeouts[p]++
}
}

probe kernel.function("sys_epoll_wait").return {
if ($return == 0) {
p = pid()
if (!(p in process))
process[p] = execname()
epoll_timeouts[p]++
}
}

probe kernel.function("do_futex").return {
if ($return == -110) {
p = pid()
if (!(p in process))
process[p] = execname()
futex_timeouts[p]++
}
}

probe kernel.function("hrtimer_nanosleep").return,
kernel.function("sys_clock_nanosleep").return {
if ($return == 0) {
p = pid()
if (!(p in process))
process[p] = execname()
nanosleep_timeouts[p]++
}
}

probe kernel.function("it_real_fn") {
p = pid()
itimer_timeouts[p]++
if (!(p in process))
process[p] = execname()
}

probe kernel.function("sys_rt_sigtimedwait").return {
if ($return == -11) {
p = pid()
if (!(p in process))
process[p] = execname()
signal_timeouts[p]++
}
}

probe kernel.function("do_exit") {
p = pid()
if (process[p] == execname()) {
delete process[p]
poll_timeouts[p] = 0
epoll_timeouts[p] = 0
select_timeouts[p] = 0
itimer_timeouts[p] = 0
futex_timeouts[p] = 0
nanosleep_timeouts[p] = 0
signal_timeouts[p] = 0
}
}

probe timer.ms(1000) {
printf("33[2J33[1;1H") /* clear screen */
printf (" uid | poll select epoll itimer futex nanosle signal| process
");
foreach (p in process) {
if (poll_timeouts[p] != 0 || select_timeouts[p] != 0
|| epoll_timeouts[p] != 0 || itimer_timeouts[p] != 0
|| futex_timeouts[p] != 0 || nanosleep_timeouts[p] != 0
|| signal_timeouts[p] != 0)
printf ("%5d |%7d %7d %7d %7d %7d %7d %7d| %-.38s
", p,
poll_timeouts[p], select_timeouts[p],
epoll_timeouts[p], itimer_timeouts[p],
futex_timeouts[p], nanosleep_timeouts[p],
signal_timeouts[p], process[p])
}
}
--
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list
 
Old 07-15-2008, 05:57 AM
Arjan van de Ven
 
Default process wakeups

On Mon, 14 Jul 2008 14:57:56 -0700
Ulrich Drepper <drepper@redhat.com> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> One of the worst problems wrt energy savings we have today are all the
> wakeups processes request. This is not just an issue for laptops, it
> relevant everywhere.
>
> To see the size of the problem run the attached systemtap script. On
> my laptop I see the following output (47 secs runtime):


just a question.. is there anything this script does that powertop
doesn't yet do?

> I would hope the package maintainers can find some time and look at
> the issues. Maybe at least document them in a BZ.

there is a metabug for these things in bugzilla with the "wakeup"
alias...


--
If you want to reach me at my work email, use arjan@linux.intel.com
For development, discussion and tips for power savings,
visit http://www.lesswatts.org

--
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list
 
Old 07-15-2008, 11:06 AM
Matthew Garrett
 
Default process wakeups

On Mon, Jul 14, 2008 at 02:57:56PM -0700, Ulrich Drepper wrote:

> I would hope the package maintainers can find some time and look at the
> issues. Maybe at least document them in a BZ. I might try to do the
> latter myself but given the large number of packages involved I'll most
> likely be able to cover just a few packages. IMO it should be a release
> criteria that a program does use polling.

There are certain situations where polling is inevitable (such as
querying hardware for battery status or signal strength, pulling mail,
that kind of thing). Applications that do this should do it at
relatively low frequency, and where possible (ie, almost always) use
g_timeout_add_seconds or equivalent functionality. It's pretty
inevitable that we'll have one wakeup a second, and ensuring that all
applications that need to be woken during that second are woken at the
same time has a significant benefit on power consumption.

--
Matthew Garrett | mjg59@srcf.ucam.org

--
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list
 
Old 07-15-2008, 11:30 AM
Harald Hoyer
 
Default process wakeups

Matthew Garrett wrote:

On Mon, Jul 14, 2008 at 02:57:56PM -0700, Ulrich Drepper wrote:


I would hope the package maintainers can find some time and look at the
issues. Maybe at least document them in a BZ. I might try to do the
latter myself but given the large number of packages involved I'll most
likely be able to cover just a few packages. IMO it should be a release
criteria that a program does use polling.


There are certain situations where polling is inevitable (such as
querying hardware for battery status or signal strength, pulling mail,
that kind of thing). Applications that do this should do it at
relatively low frequency, and where possible (ie, almost always) use
g_timeout_add_seconds or equivalent functionality. It's pretty
inevitable that we'll have one wakeup a second, and ensuring that all
applications that need to be woken during that second are woken at the
same time has a significant benefit on power consumption.





g_timeout_add_seconds does not "really" sync globally.

The kernel could schedule a common (across all apps) wakeup time a little bit
better than g_timeout_add_seconds(), if the application could specify a time
"range" of how long it would like to approx. sleep. Also g_timeout_add_seconds()
does not work with select/poll.


--
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list
 
Old 07-15-2008, 01:04 PM
Richard Hughes
 
Default process wakeups

On Mon, 2008-07-14 at 14:57 -0700, Ulrich Drepper wrote:
> 3112 | 32 0 0 0 0 0 0| gpk-update-icon

All wakeups fixed in git master -- should be essentially polling free
apart from when actually being used.

> 3115 | 29 0 0 0 0 0 0| gnome-power-man

Harder to fix, as we still have to poll the xserver to see if dpms has
been enabled every now and then. There's a fix in the works for this, as
X will send out notification of the changed state.

Richard.


--
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list
 
Old 07-15-2008, 01:39 PM
Steve Grubb
 
Default process wakeups

On Monday 14 July 2008 17:57:56 Ulrich Drepper wrote:
> Still, since the script records wakeups due to timeouts almost all
> mentions on this list are bad. *Programs should be woken based on
> events. *They shouldn't poll data (which is what usually happens after a
> timeout).

One of the worst that I've found that's not on the list is mysqld. It has 2
threads that just never stop.

-Steve

--
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list
 
Old 07-15-2008, 02:28 PM
Matthew Garrett
 
Default process wakeups

On Tue, Jul 15, 2008 at 01:30:50PM +0200, Harald Hoyer wrote:

> g_timeout_add_seconds does not "really" sync globally.

Yeah, it's non-ideal. Anything better is going to need at least glibc
(and ideally kernel) support.

--
Matthew Garrett | mjg59@srcf.ucam.org

--
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list
 
Old 07-15-2008, 02:39 PM
Ulrich Drepper
 
Default process wakeups

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Matthew Garrett wrote:
> There are certain situations where polling is inevitable (such as
> querying hardware for battery status or signal strength, pulling mail,
> that kind of thing).

For querying hardware there should be better ways. Have a centralized
place where the information is poll and the broadcast changes. I though
hal etc is supposed to do this.

As for mail pulling: sure. But the frequency should be measured in
minutes and not in micro-seconds.


> Applications that do this should do it at
> relatively low frequency, and where possible (ie, almost always) use
> g_timeout_add_seconds or equivalent functionality.

I assume this refers to the same thing Arjan tried to do: group wakeups
of multiple waiters together. He can probably recall the details more
easily than I can.

- --
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkh8tq0ACgkQ2ijCOnn/RHRF/QCfeGAbjuejLQl5MDhNQafy7edA
coYAn0a3cULC+vdaYVRAZOEHMA2rnQ/d
=rW6D
-----END PGP SIGNATURE-----

--
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list
 
Old 07-15-2008, 02:50 PM
Arjan van de Ven
 
Default process wakeups

On Tue, 15 Jul 2008 07:39:41 -0700
Ulrich Drepper <drepper@redhat.com> wrote:

> > Applications that do this should do it at
> > relatively low frequency, and where possible (ie, almost always)
> > use g_timeout_add_seconds or equivalent functionality.
>
> I assume this refers to the same thing Arjan tried to do: group
> wakeups of multiple waiters together. He can probably recall the
> details more easily than I can.


g_timeout_add_seconds() is what I did ;-)

it's not ideal (it doesn't allow for a range, and it only works for
glib based apps).. but it's the best we have for userspace so far.
we really ought to do a range based timeout (or a precision specifier)


--
If you want to reach me at my work email, use arjan@linux.intel.com
For development, discussion and tips for power savings,
visit http://www.lesswatts.org

--
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list
 
Old 07-15-2008, 03:15 PM
"Bill Crawford"
 
Default process wakeups

2008/7/15 Steve Grubb <sgrubb@redhat.com>:
...
> One of the worst that I've found that's not on the list is mysqld. It has 2
> threads that just never stop.

I see about 1 wakeup per second from mysqld (it's currently idle,
though). What are you seeing there?

--
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list
 

Thread Tools




All times are GMT. The time now is 05:29 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org