STRUCT CALLBACK_HEAD(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– struct callback_head(9) β€” Kernel API Manual πŸ’–

okay so bestie, this is the callback struct page and it's lowkey iconic for RCU girlies and task_work besties. let's get into it. ✨

🌸 NAME 🌸

struct callback_head β€” callback structure for use with RCU and task_work

✨ SYNOPSIS ✨

struct callback_head {
    struct callback_head *next;
    void (*func)(struct callback_head *head);
 };

🫢 Members 🫢

  • next β€” next update requests in a list
  • func β€” actual update function to call after the grace period.

πŸ¦‹ Description πŸ¦‹

Okay so the struct is aligned to size of pointer. On most architectures it happens naturally due ABI requirements, but some architectures (like CRIS) have weird ABI and we need to ask it explicitly. πŸ’…

The alignment is required to guarantee that bit 0 of next will be clear under normal conditions -- as long as we use call_rcu or call_srcu to queue the callback. πŸ”₯

This guarantee is important for few reasons:

  • future call_rcu_lazy will make use of lower bits in the pointer;
  • the structure shares storage space in struct page with compound_info, which encode PageTail in bit 0. The guarantee is needed to avoid false-positive PageTail.

that's the tea, no cap. πŸ“

🌈 SEE ALSO 🌈

Kernel file ./include/linux/types.h β€” go peek, iykyk. 🫢


πŸ’– that's the whole page, bestie. source: ./include/linux Β· date: October 2026 Β· manual: struct callback_head(9). mwah πŸ’‹

πŸ“¦ where this page comes from