kernel/rcu/tree_exp.h
Source file repositories/reference/linux-study-clean/kernel/rcu/tree_exp.h
File Facts
- System
- Linux kernel
- Corpus path
kernel/rcu/tree_exp.h- Extension
.h- Size
- 35496 bytes
- Lines
- 1119
- Domain
- Core OS
- Bucket
- Scheduler, Processes, Timers, Sync, And Syscalls
- Inferred role
- Core OS: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/console.hlinux/lockdep.h
Detected Declarations
function rcu_exp_gp_seq_startfunction rcu_exp_gp_seq_endvalfunction rcu_exp_gp_seq_endfunction rcu_exp_gp_seq_snapfunction rcu_exp_gp_seq_snapfunction sync_exp_reset_tree_hotplugfunction sync_exp_reset_treefunction sync_rcu_exp_donefunction sync_rcu_exp_donefunction __rcu_report_exp_rnpfunction rcu_report_exp_rnpfunction rcu_report_exp_cpu_multfunction rcu_datafunction sync_exp_work_donefunction exp_funnel_lockfunction __sync_rcu_exp_select_node_cpusfunction sync_rcu_exp_select_node_cpusfunction rcu_exp_worker_startedfunction rcu_exp_par_worker_startedfunction sync_rcu_exp_select_cpus_queue_workfunction sync_rcu_exp_select_cpus_flush_workfunction wait_rcu_exp_gpfunction synchronize_rcu_expedited_queue_workfunction sync_rcu_exp_select_cpusfunction synchronize_rcu_expedited_wait_oncefunction synchronize_rcu_expedited_stallfunction for_each_leaf_node_possible_cpufunction rcu_for_each_node_breadth_firstfunction for_each_leaf_node_possible_cpufunction synchronize_rcu_expedited_waitfunction rcu_for_each_leaf_nodefunction for_each_leaf_node_cpu_maskfunction rcu_exp_wait_wakefunction rcu_for_each_node_breadth_firstfunction rcu_exp_sel_wait_wakefunction rcu_exp_need_qsfunction smp_call_function_singlefunction rcu_read_unlockfunction rcu_print_task_exp_stallfunction rcu_exp_print_detail_task_stall_rnpfunction rcu_exp_handlerfunction rcu_print_task_exp_stallfunction rcu_exp_print_detail_task_stall_rnpfunction start_poll_synchronize_rcu_expeditedfunction cond_synchronize_rcufunction cond_synchronize_rcu_fullfunction get_state_synchronize_rcufunction get_state_synchronize_rcu_full
Annotated Snippet
if (rnp->expmaskinit == rnp->expmaskinitnext) {
raw_spin_unlock_irqrestore_rcu_node(rnp, flags);
continue; /* No new CPUs, nothing to do. */
}
/* Update this node's mask, track old value for propagation. */
oldmask = rnp->expmaskinit;
rnp->expmaskinit = rnp->expmaskinitnext;
raw_spin_unlock_irqrestore_rcu_node(rnp, flags);
/* If was already nonzero, nothing to propagate. */
if (oldmask)
continue;
/* Propagate the new CPU up the tree. */
mask = rnp->grpmask;
rnp_up = rnp->parent;
done = false;
while (rnp_up) {
raw_spin_lock_irqsave_rcu_node(rnp_up, flags);
if (rnp_up->expmaskinit)
done = true;
rnp_up->expmaskinit |= mask;
raw_spin_unlock_irqrestore_rcu_node(rnp_up, flags);
if (done)
break;
mask = rnp_up->grpmask;
rnp_up = rnp_up->parent;
}
}
}
/*
* Reset the ->expmask values in the rcu_node tree in preparation for
* a new expedited grace period.
*/
static void __maybe_unused sync_exp_reset_tree(void)
{
unsigned long flags;
struct rcu_node *rnp;
sync_exp_reset_tree_hotplug();
rcu_for_each_node_breadth_first(rnp) {
raw_spin_lock_irqsave_rcu_node(rnp, flags);
WARN_ON_ONCE(rnp->expmask);
WRITE_ONCE(rnp->expmask, rnp->expmaskinit);
/*
* Need to wait for any blocked tasks as well. Note that
* additional blocking tasks will also block the expedited GP
* until such time as the ->expmask bits are cleared.
*/
if (rcu_is_leaf_node(rnp) && rcu_preempt_has_tasks(rnp))
WRITE_ONCE(rnp->exp_tasks, rnp->blkd_tasks.next);
raw_spin_unlock_irqrestore_rcu_node(rnp, flags);
}
}
/*
* Return non-zero if there is no RCU expedited grace period in progress
* for the specified rcu_node structure, in other words, if all CPUs and
* tasks covered by the specified rcu_node structure have done their bit
* for the current expedited grace period.
*/
static bool sync_rcu_exp_done(struct rcu_node *rnp)
{
raw_lockdep_assert_held_rcu_node(rnp);
return READ_ONCE(rnp->exp_tasks) == NULL &&
READ_ONCE(rnp->expmask) == 0;
}
/*
* Like sync_rcu_exp_done(), but where the caller does not hold the
* rcu_node's ->lock.
*/
static bool sync_rcu_exp_done_unlocked(struct rcu_node *rnp)
{
unsigned long flags;
bool ret;
raw_spin_lock_irqsave_rcu_node(rnp, flags);
ret = sync_rcu_exp_done(rnp);
raw_spin_unlock_irqrestore_rcu_node(rnp, flags);
return ret;
}
/*
* Report the exit from RCU read-side critical section for the last task
* that queued itself during or before the current expedited preemptible-RCU
* grace period. This event is reported either to the rcu_node structure on
Annotation
- Immediate include surface: `linux/console.h`, `linux/lockdep.h`.
- Detected declarations: `function rcu_exp_gp_seq_start`, `function rcu_exp_gp_seq_endval`, `function rcu_exp_gp_seq_end`, `function rcu_exp_gp_seq_snap`, `function rcu_exp_gp_seq_snap`, `function sync_exp_reset_tree_hotplug`, `function sync_exp_reset_tree`, `function sync_rcu_exp_done`, `function sync_rcu_exp_done`, `function __rcu_report_exp_rnp`.
- Atlas domain: Core OS / Scheduler, Processes, Timers, Sync, And Syscalls.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.