kernel/rcu/tree_stall.h
Source file repositories/reference/linux-study-clean/kernel/rcu/tree_stall.h
File Facts
- System
- Linux kernel
- Corpus path
kernel/rcu/tree_stall.h- Extension
.h- Size
- 36797 bytes
- Lines
- 1185
- 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/kvm_para.hlinux/rcu_notifier.hlinux/smp.h
Detected Declarations
struct rcu_stall_chk_rdrfunction init_rcu_stall_sysctlfunction rcu_stall_count_showfunction kernel_rcu_stall_sysfs_initfunction rcu_exp_jiffies_till_stall_checkfunction rcu_jiffies_till_stall_checkfunction rcu_sysrq_startfunction rcu_sysrq_endfunction rcu_panicfunction check_cpu_stall_initfunction panic_on_rcu_stallfunction rcu_cpu_stall_resetfunction record_gp_stall_check_timefunction zero_cpu_stall_ticksfunction rcu_stall_kick_kthreadsfunction rcu_iw_handlerfunction rcu_print_detail_task_stall_rnpfunction check_slow_taskfunction rcu_print_task_stallfunction rcu_print_detail_task_stall_rnpfunction rcu_dump_cpu_stacksfunction rcu_for_each_leaf_nodefunction for_each_leaf_node_possible_cpufunction rcu_is_gp_kthread_starvingfunction rcu_is_rcuc_kthread_starvingfunction print_cpu_stat_infofunction print_cpu_stall_infofunction rcu_check_gp_kthread_starvationfunction rcu_check_gp_kthread_expired_fqs_timerfunction print_other_cpu_stallfunction print_cpu_stallfunction check_cpu_stallfunction cmpxchgfunction rcu_check_boost_failfunction rcu_for_each_leaf_nodefunction for_each_leaf_node_possible_cpufunction show_rcu_gp_kthreadsfunction for_each_leaf_node_possible_cpufunction rcu_check_gp_start_stallfunction ULONG_CMP_GEfunction ULONG_CMP_GEfunction rcu_fwd_progress_checkfunction sysrq_show_rcufunction rcu_sysrq_initfunction rcu_stall_chain_notifier_registerfunction rcu_stall_chain_notifier_unregisterfunction rcu_stall_notifier_call_chainmodule init init_rcu_stall_sysctl
Annotated Snippet
subsys_initcall(init_rcu_stall_sysctl);
#ifdef CONFIG_SYSFS
static unsigned int rcu_stall_count;
static ssize_t rcu_stall_count_show(struct kobject *kobj, struct kobj_attribute *attr,
char *page)
{
return sysfs_emit(page, "%u\n", rcu_stall_count);
}
static struct kobj_attribute rcu_stall_count_attr = __ATTR_RO(rcu_stall_count);
static __init int kernel_rcu_stall_sysfs_init(void)
{
sysfs_add_file_to_group(kernel_kobj, &rcu_stall_count_attr.attr, NULL);
return 0;
}
late_initcall(kernel_rcu_stall_sysfs_init);
#endif // CONFIG_SYSFS
#ifdef CONFIG_PROVE_RCU
#define RCU_STALL_DELAY_DELTA (5 * HZ)
#else
#define RCU_STALL_DELAY_DELTA 0
#endif
#define RCU_STALL_MIGHT_DIV 8
#define RCU_STALL_MIGHT_MIN (2 * HZ)
int rcu_exp_jiffies_till_stall_check(void)
{
int cpu_stall_timeout = READ_ONCE(rcu_exp_cpu_stall_timeout);
int exp_stall_delay_delta = 0;
int till_stall_check;
// Zero says to use rcu_cpu_stall_timeout, but in milliseconds.
if (!cpu_stall_timeout)
cpu_stall_timeout = jiffies_to_msecs(rcu_jiffies_till_stall_check());
// Limit check must be consistent with the Kconfig limits for
// CONFIG_RCU_EXP_CPU_STALL_TIMEOUT, so check the allowed range.
// The minimum clamped value is "2UL", because at least one full
// tick has to be guaranteed.
till_stall_check = clamp(msecs_to_jiffies(cpu_stall_timeout), 2UL, 300UL * HZ);
if (cpu_stall_timeout && jiffies_to_msecs(till_stall_check) != cpu_stall_timeout)
WRITE_ONCE(rcu_exp_cpu_stall_timeout, jiffies_to_msecs(till_stall_check));
#ifdef CONFIG_PROVE_RCU
/* Add extra ~25% out of till_stall_check. */
exp_stall_delay_delta = ((till_stall_check * 25) / 100) + 1;
#endif
return till_stall_check + exp_stall_delay_delta;
}
EXPORT_SYMBOL_GPL(rcu_exp_jiffies_till_stall_check);
/* Limit-check stall timeouts specified at boottime and runtime. */
int rcu_jiffies_till_stall_check(void)
{
int till_stall_check = READ_ONCE(rcu_cpu_stall_timeout);
/*
* Limit check must be consistent with the Kconfig limits
* for CONFIG_RCU_CPU_STALL_TIMEOUT.
*/
if (till_stall_check < 3) {
WRITE_ONCE(rcu_cpu_stall_timeout, 3);
till_stall_check = 3;
} else if (till_stall_check > 300) {
WRITE_ONCE(rcu_cpu_stall_timeout, 300);
till_stall_check = 300;
}
return till_stall_check * HZ + RCU_STALL_DELAY_DELTA;
}
EXPORT_SYMBOL_GPL(rcu_jiffies_till_stall_check);
/* Don't do RCU CPU stall warnings during long sysrq printouts. */
void rcu_sysrq_start(void)
{
if (!rcu_cpu_stall_suppress)
rcu_cpu_stall_suppress = 2;
}
void rcu_sysrq_end(void)
{
if (rcu_cpu_stall_suppress == 2)
Annotation
- Immediate include surface: `linux/console.h`, `linux/kvm_para.h`, `linux/rcu_notifier.h`, `linux/smp.h`.
- Detected declarations: `struct rcu_stall_chk_rdr`, `function init_rcu_stall_sysctl`, `function rcu_stall_count_show`, `function kernel_rcu_stall_sysfs_init`, `function rcu_exp_jiffies_till_stall_check`, `function rcu_jiffies_till_stall_check`, `function rcu_sysrq_start`, `function rcu_sysrq_end`, `function rcu_panic`, `function check_cpu_stall_init`.
- 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.