STRUCT IDLE_INJECT_DEVICE(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct idle_inject_device(9)

okay so this is a page from the Kernel API Manual, and we're talking about struct idle_inject_device β€” literally the vibe container for idle injection data. yes bestie, CPUs need naps too πŸŽ€


✨ NAME ✨

struct idle_inject_device β€” the idle injection data struct. that's it, that's the whole name, iconic.


πŸ¦‹ SYNOPSIS πŸ¦‹

struct idle_inject_device {
    struct hrtimer timer;
    unsigned int idle_duration_us;
    unsigned int run_duration_us;
    unsigned int latency_us;
    bool (*update)(void);
    unsigned long cpumask[];
};

no cap, that's the whole shape of it. let's break down every single member because we do NOT skip πŸ’…


🌸 Members 🌸

  • timer β€” the idle injection period timer. she keeps the beat πŸ₯
  • idle_duration_us β€” how long the injected CPU idle time lasts. the nap length, basically 😴
  • run_duration_us β€” how long the CPU is allowed to actually run. the grind length πŸ”₯
  • latency_us β€” the max allowed latency. don't let it go past this, fr.
  • update β€” an optional callback that decides whether or not to skip idle injection in the given cycle. like a little vibe check gatekeeper 🫢
  • cpumask β€” the mask of CPUs affected by idle injection. the guest list, and yes it's a flexible array member, slay.

🧚 Description 🧚

This structure is used to define per instance idle inject device data. Each instance has an idle duration, a run duration, and a mask of CPUs to inject idle. one instance, one whole little setup, periodt.

The actual CPU idle time gets injected by calling the kernel scheduler interface play_idle_precise. that's the one doing the real work, we just respect her πŸ‘‘

There is one optional callback that can be registered by calling idle_inject_register_full:

  • update β€” this callback is invoked just before waking up CPUs to inject idle. If it returns false, the CPUs are not woken up to inject idle in the given cycle. It also lets the caller readjust the idle and run duration by calling idle_inject_set_duration for the next cycle. so like, you get a say in your own destiny, lowkey iconic πŸ’–

🌈 SEE ALSO 🌈

Kernel file ./drivers/powercap/idle_inject.c struct idle_inject_thread(9), idle_inject_wakeup(9), idle_inject_timer_fn(9), idle_inject_fn(9), idle_inject_set_duration(9), idle_inject_get_duration(9), idle_inject_set_latency(9), idle_inject_start(9), idle_inject_stop(9), idle_inject_setup(9), idle_inject_should_run(9), idle_inject_register_full(9), idle_inject_register(9), idle_inject_unregister(9)

go read all of them, iyktyk, they're all besties fr fr 🫢✨


πŸŽ€ little sign-off from the ./drivers/powercap girlies: this page is dated October 2026, so it's giving future-forward main character energy. mwah πŸ’‹ stay idle, stay iconic πŸ’…πŸ”₯
πŸ“¦ where this page comes from