STRUCT HRTIMER(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ struct hrtimer(9) ✨

okay so bestie, welcome to the Kernel API Manual β€” we're talking about struct hrtimer, and honestly? she's kind of a big deal πŸ’…


🌸 NAME 🌸

struct hrtimer β€” the basic hrtimer structure. that's it, that's the vibe. the blueprint. the main character πŸ’–


πŸ¦‹ SYNOPSIS πŸ¦‹

struct hrtimer {
    struct timerqueue_linked_node   node;
    struct hrtimer_clock_base       *base;
    bool is_queued;
    bool is_rel;
    bool is_soft;
    bool is_hard;
    bool is_lazy;
    ktime_t _softexpires;
    enum hrtimer_restart            (*function)(struct hrtimer *);
 };

like look at her. gorgeous. no notes πŸŽ€


🧩 Members 🧩

let me introduce you to the whole squad, one field at a time πŸ‘‘

  • node β€” the linked timerqueue node, and she's a multitasker: she also manages node.expires, which is the absolute expiry time in the hrtimer's internal representation. the time is related to the clock the timer is based on. it gets set up by adding slack to the _softexpires value β€” and for non range timers it's identical to _softexpires. slay 🌈
  • base β€” pointer to the timer base (per cpu and per clock). two whole dimensions of context, we love to see it ✨
  • is_queued β€” indicates whether a timer is enqueued or not. the "are you in the group chat or not" flag fr fr πŸ’€
  • is_rel β€” set if the timer was armed relative πŸ‘€
  • is_soft β€” set if the hrtimer will be expired in soft interrupt context πŸ“
  • is_hard β€” set if the hrtimer will be expired in hard interrupt context, even on RT. hard mode literally 😭πŸ”₯
  • is_lazy β€” set if the timer is frequently rearmed to avoid updates of the clock event device. she's being lazy on purpose and honestly? valid πŸ™ˆ
  • _softexpires β€” the absolute earliest expiry time of the hrtimer. it's the time that was given as the expiry time when the timer was armed. the og value, iykyk ⭐
  • function β€” the timer expiry callback function. when the timer goes off, this is the queen who gets called πŸ‘‘ enum hrtimer_restart (*function)(struct hrtimer *) β€” she takes a struct hrtimer * and tells you how to restart. iconic signature πŸ’œ

πŸ’– Description πŸ’–

the hrtimer structure must be initialized by hrtimer_setup β€” no cap, do not skip this step, do not just memset and hope for the best 🫢

⚠️ bestie this is a requirement, not a suggestion: hrtimer_setup is the initialization path here. periodt.

🌟 SEE ALSO 🌟

  • Kernel file ./include/linux/hrtimer_types.h β€” go read her sister file, she's got lore 🧚

and that's the whole page, bestie!! πŸ¦‹πŸ’–

source location: ./include/linux 🌸 dated: October 2026 πŸŽ€ β€” mwah, catch you in the next manpage πŸ’…βœ¨

πŸ“¦ where this page comes from