Skip to content

linux/kernel/rcu/tree.c

Imported from _research/manual-study-linux/file-notes/linux__kernel__rcu__tree.c.md.

File Notes: kernel/rcu/tree.c

Status: reviewed.

Purpose: tree RCU implementation.

Review target: grace periods, read-side contracts, callbacks, and Rust lifetime translation limits.

Evidence

  • The file describes itself as the tree-based Read-Copy Update implementation at lines 3-16.
  • Per-CPU rcu_data is defined at line 80.
  • Global rcu_state is initialized at line 92.
  • rcu_scheduler_active is documented around lines 130-140 as a boot-time state transition from inactive to init to running.
  • include/linux/rcupdate.h declares public interfaces such as call_rcu() and synchronize_rcu() around lines 50-54.
  • In non-preempt RCU builds, __rcu_read_lock() disables preemption around lines 101-104 and __rcu_read_unlock() reenables it around lines 106-110.

Design Notes

RCU is a lifetime protocol, not just a lock. A Rust wrapper needs a read guard, an RCU-protected pointer type, and deferred reclamation. Some unsafe code remains necessary at publication and reclamation boundaries.