# Powertop: reduce count of wakeups

## manuels

Hi,

I'm getting this output of powertop:

```
Top causes for wakeups:

  43.8% (226.6)       <interrupt> : extra timer interrupt

  25.0% (129.2)       <interrupt> : nvidia, wifi0

  19.5% (100.6)       <interrupt> : eth0

   5.1% ( 26.4)           firefox : futex_wait (hrtimer_wakeup)

   2.1% ( 10.8)       <interrupt> : ide0

   0.8% (  4.2)       <interrupt> : sata_nv

   0.7% (  3.8)              kded : schedule_timeout (process_timeout)

   0.4% (  2.0)      <kernel IPI> : Rescheduling interrupts

   0.3% (  1.6)    wpa_supplicant : schedule_timeout (process_timeout)

   0.3% (  1.4)                 X : do_setitimer (it_real_fn)

   0.2% (  1.0)                 X : nv_start_rc_timer (nv_kern_rc_timer)

   0.2% (  1.0)     <kernel core> : ath_detach (ath_intr)

   0.2% (  1.0)            dhcdbd : schedule_timeout (process_timeout)

   0.2% (  0.8)           yakuake : schedule_timeout (process_timeout)

   0.2% (  0.8)     <kernel core> : neigh_table_init_no_netlink (neigh_periodic_timer)

```

I'm using a tickless system but there are still high number of these 'extra timer interrupt'.

Does anybody of you have a hint for me to minimize this number of wakeups?

Some information about my system:

```
Linux roadrunner 2.6.26-tuxonice #5 SMP PREEMPT Sun Sep 28 22:29:06 CEST 2008 x86_64 AMD Turion(tm) 64 X2 Mobile Technology TL-50 AuthenticAMD GNU/Linux 
```

my kernel config

----------

## dmpogo

No hints, I recently googled extensively for this question and found nothing, besides that they are still present.

They are, however, < 10% of what I had in timer interrupts before going tickless

----------

## Hypnos

Are you using hpet?  If not, enable it in your kernel.

'dmesg | grep -i hpet' should give a bunch of stuff.  My output:

```
ACPI: HPET 7E6CBD16, 0038 (r1 LENOVO TP-7L        2210 LNVO        1)

ACPI: HPET id: 0x8086a201 base: 0xfed00000

hpet clockevent registered

TSC calibrated against HPET

hpet0: at MMIO 0xfed00000, IRQs 2, 8, 0

hpet0: 3 64-bit timers, 14318180 Hz

Time: hpet clocksource has been installed.

hpet_resources: 0xfed00000 is busy
```

----------

## manuels

Sorry for my late response.

Yes, I am using it:

```
ACPI: HPET 3FF69F42, 0038 (r1 PTLTD  HPETTBL   6040000  LTP        1)

ACPI: HPET id: 0x10de8201 base: 0xfed00000

hpet clockevent registered

HPET: 3 timers in total, 0 timers will be used for per-cpu timer

hpet0: at MMIO 0xfed00000, IRQs 2, 8, 31

hpet0: 3 comparators, 32-bit 25.000000 MHz counter

CE: hpet increasing min_delta_ns to 15000 nsec

CE: hpet increasing min_delta_ns to 22500 nsec

```

----------

## Hypnos

My output on battery power:

```
Cn                Avg residency       P-states (frequencies)

C0 (cpu running)        ( 5.9%)         2.21 Ghz     3.8%

C1                0.0ms ( 0.0%)         2.21 Ghz     0.0%

C2                0.1ms ( 0.0%)         1.60 Ghz     0.1%

C3                3.9ms (94.1%)          800 Mhz    96.1%

Wakeups-from-idle per second : 244.5    interval: 10.0s

Power usage (ACPI estimate): 15.1W (3.7 hours)

Top causes for wakeups:

  22.3% ( 50.0)            hdapsd : hdaps_mousedev_open (hdaps_mousedev_poll) 

  20.9% ( 46.9)       <interrupt> : uhci_hcd:usb4, HDA Intel, ohci1394 

  17.6% ( 39.5)      <kernel IPI> : Rescheduling interrupts 

  11.5% ( 25.9)          epiphany : futex_wait (hrtimer_wakeup) 

   5.7% ( 12.7)       <interrupt> : iwl3945 

   5.1% ( 11.5)             skype : schedule_hrtimeout_range (hrtimer_wakeup) 

```

I have implemented all the hints that powertop gives me, and I've had significant improvement in "rescheduling interrupts" by upgrading to kernel 2.6.29.  If I disable HDAPS I attain the target of 95% residency in the CPU state C3.  (Interestingly, I attain the goal easily while on AC -- I wonder if some ACPI thing is causing interrupts while on battery power.)

If you're not running a recent kernel, you might give it a try ...

Also, I don't understand your dmesg output entirely -- HPET is detected, but I wonder if it's actually being used ...

----------

## theotherjoe

Hypnos,

here is how to find out about your current clocksource

# cat /sys/devices/system/clocksource/clocksource0/current_clocksource

and via

# cat /sys/devices/system/clocksource/clocksource0/available_clocksource

have a look at the different possible clocks to employ

----------

## manuels

Hi,

 *Hypnos wrote:*   

> [...]If you're not running a recent kernel, you might give it a try ...

 

I'm using suspend to ram/disk with tuxonice-sources and I just see that there is a new 2.6.29 version.

Ok, I'll compile it tomorrow and see if it will reduce the wakeups.

 *Quote:*   

> Also, I don't understand your dmesg output entirely -- HPET is detected, but I wonder if it's actually being used ...
> 
>  *Quote:*   here is how to find out about your current clocksource
> 
> # cat /sys/devices/system/clocksource/clocksource0/current_clocksource  
> ...

 

That gives me

```
# cat /sys/devices/system/clocksource/clocksource0/current_clocksource 

hpet
```

So it seems to be enabled.

Nevertheless, I'll give the .29 sources a try. I let you know if there are any news.

Cheers,

Manuel

----------

## Hypnos

FWIW, I upgraded from acpid-1.0.6-r1 to acpid-1.0.10_p3 and now my C3 residency is 97-98%, even with wireless and HDAPS running.

This upgrade finally moves acpid to the netlink interface from the old /proc/acpi/event -- perhaps this method of communication is more efficient.

----------

## manuels

That didn't work for me:

```
                                      P-states (frequencies)

                                        1.60 Ghz     0.0%

                                         800 Mhz   100.0%

< Detailed C-state information is only available on Mobile CPUs (laptops) >

Wakeups-from-idle per second : 201.1    interval: 10.0s

no ACPI power usage estimate available

Top causes for wakeups:

  51.1% (177.0)       <interrupt> : wifi0, nvidia

  22.1% ( 76.4)       <interrupt> : PS/2 keyboard/mouse/touchpad

   5.5% ( 19.1)       <interrupt> : extra timer interrupt

   4.5% ( 15.7)      <kernel IPI> : Rescheduling interrupts

   3.9% ( 13.6)                 X : do_setitimer (it_real_fn)

   3.7% ( 12.7)           firefox : futex_wait (hrtimer_wakeup)

   1.9% (  6.7)              kwin : schedule_hrtimeout_range (hrtimer_wakeup)

   1.4% (  5.0)            amarok : schedule_hrtimeout_range (hrtimer_wakeup)

   0.9% (  3.2)           yakuake : schedule_hrtimeout_range (hrtimer_wakeup)

   0.9% (  3.0)          knotify4 : schedule_hrtimeout_range (hrtimer_wakeup)

   0.6% (  2.1)       <interrupt> : sata_nv

   0.6% (  2.0)   thunderbird-bin : futex_wait (hrtimer_wakeup)

```

Seems that I really must update to a newer kernel - actually, I'm a bit to lazy to do that...

----------

## Hypnos

200 wakeups/seconds isn't bad per se -- it depends on what is causing the wakeup.  nvidia and wifi are fairly power-hungry   :Smile: 

You really need C-state data to know how these interrupts are hurting the efficiency of your CPU, which is very power hungry.  One experiment to try is with and without the wifi enabled.

Also, keyboard/mouse interrupts shouldn't happen unless you are using them ...

----------

