JDK-6587671 : JRE wakes up kernel 20 times per second when idle
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 6
  • Priority: P5
  • Status: Closed
  • Resolution: Won't Fix
  • OS: linux
  • CPU: x86
  • Submitted: 2007-07-31
  • Updated: 2014-03-12
  • Resolved: 2014-03-12
Description
FULL PRODUCT VERSION :
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)


FULL OS VERSION :
Linux vertex.dottedmag.net 2.6.22 #1 SMP Mon Jul 9 06:58:04 UTC 2007 i686 GNU/Linux


A DESCRIPTION OF THE PROBLEM :
JRE wakes up 20 times per second while program does nothing (e.g. sleeping or waiting for GUI events).

This drains power and dramatically decreases laptops' life on battery (kernel can't turn CPU into ACPI C3 powersaving state or deeper due to constant wakeups).


THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Yes

THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Yes

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Install PowerTOP tool (http://www.linuxpowertop.org/)
2. Run any Java program (e.g. trivial attached one)
3. Watch for the java wakeups in PowerTOP.


EXPECTED VERSUS ACTUAL BEHAVIOR :
JRE wakes up 20 times per second, while it is not doing anything. It is supposed to wake up only on events to consume as little power as possible.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
public class HelloWorld {
    public static void main(String args[]) throws Exception {
        while(true)
            Thread.sleep(10000);
    }
}

---------- END SOURCE ----------

Comments
Closing as WNF based on David's comment.
2014-03-12

I think we can close this as "Will not fix" for SE. -UsePerfData fixes the problem and low-power devices should be using SE-Embedded.
2013-10-16

Note the SE-Embedded VMs already deal with this by disabling the WatcherThread unless a periodic task has been registered. Further by default UsePerfData is false so that task is not registered, and other periodic activity was moved elsewhere.
2010-08-31

EVALUATION The JVM has execution requirements beyond those explicit in the threads of the application. There are numerous threads in the VM itself which may be active when the application is idle. In particular the VM internally uses a periodic task mechanism to perform various monitoring and sampling activities. In this particular case with Java 6 the 50ms task is the performance sampling task. This can be disabled by specifying -XX:-UsePerfData. But be aware that other VM options (eg -Xcheck:jni) can trigger other periodic activities. Also be aware that in later VM version there may additional periodic tasks - such as the caching of the current time (disable via -XX:-CacheTimeMillis)
2007-08-01