Chapter 13. Controlling power management transitions

download PDF

You can control power management transitions to improve latency.


  • You have root permissions on the system.

13.1. Power saving states

Modern processors actively transition to higher power saving states (C-states) from lower states. Unfortunately, transitioning from a high power saving state back to a running state can consume more time than is optimal for a real-time application. To prevent these transitions, an application can use the Power Management Quality of Service (PM QoS) interface.

With the PM QoS interface, the system can emulate the behavior of the idle=poll and processor.max_cstate=1 parameters, but with a more fine-grained control of power saving states. idle=poll prevents the processor from entering the idle state. processor.max_cstate=1 prevents the processor from entering deeper C-states (energy-saving modes).

When an application holds the /dev/cpu_dma_latency file open, the PM QoS interface prevents the processor from entering deep sleep states, which cause unexpected latencies when they are being exited. When the file is closed, the system returns to a power-saving state.

13.2. Configuring power management states

You can control power management transitions by configuring power management states with one of the following ways:

  • Write a value to the /dev/cpu_dma_latency file to change the maximum response time for processes in microseconds and hold the file descriptor open until low latency is required.
  • Reference the /dev/cpu_dma_latency file in an application or a script.


  • You have administrator privileges.


  • Specify latency tolerance by writing a 32-bit number that represents a maximum response time in microseconds in /dev/cpu_dma_latency and keep the file descriptor open through the low-latency operation. A value of 0 disables C-state completely.

    For example:

    import os
    import os.path
    import signal
    import sys
    if not os.path.exists('/dev/cpu_dma_latency'):
     	print("no PM QOS interface on this system!")
    fd ='/dev/cpu_dma_latency', os.O_WRONLY)
     	 os.write(fd, b'\0\0\0\0')
     	 print("Press ^C to close /dev/cpu_dma_latency and exit")
    except KeyboardInterrupt:
        print("closing /dev/cpu_dma_latency")

    The Power Management Quality of Service interface (pm_qos) interface is only active while it has an open file descriptor. Therefore, any script or program you use to access /dev/cpu_dma_latency must hold the file open until power-state transitions are allowed.

Red Hat logoGithubRedditYoutubeTwitter


Try, buy, & sell


About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.