diff options
| author | Max Kellermann <[email protected]> | 2025-05-04 18:08:31 +0000 |
|---|---|---|
| committer | Andrew Morton <[email protected]> | 2025-06-06 05:02:25 +0000 |
| commit | 2da20fd904f87f7bb31b79719bc3dda4093f8cdb (patch) | |
| tree | cb85c128f4552d441dc08c2d68f7c309ceb51f8d | |
| parent | MAINTAINERS: add mm swap section (diff) | |
| download | kernel-2da20fd904f87f7bb31b79719bc3dda4093f8cdb.tar.gz kernel-2da20fd904f87f7bb31b79719bc3dda4093f8cdb.zip | |
kernel/rcu/tree_stall: add /sys/kernel/rcu_stall_count
Expose a simple counter to userspace for monitoring tools.
(akpm: 2536c5c7d6ae added the documentation but the code changes were lost)
Link: https://lkml.kernel.org/r/[email protected]
Fixes: 2536c5c7d6ae ("kernel/rcu/tree_stall: add /sys/kernel/rcu_stall_count")
Signed-off-by: Max Kellermann <[email protected]>
Cc: Core Minyard <[email protected]>
Cc: Doug Anderson <[email protected]>
Cc: Joel Granados <[email protected]>
Cc: Max Kellermann <[email protected]>
Cc: Song Liu <[email protected]>
Cc: Sourabh Jain <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
| -rw-r--r-- | kernel/rcu/tree_stall.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/kernel/rcu/tree_stall.h b/kernel/rcu/tree_stall.h index 56b21219442b..486c00536207 100644 --- a/kernel/rcu/tree_stall.h +++ b/kernel/rcu/tree_stall.h @@ -20,6 +20,28 @@ int sysctl_panic_on_rcu_stall __read_mostly; int sysctl_max_rcu_stall_to_panic __read_mostly; +#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 @@ -784,6 +806,10 @@ static void check_cpu_stall(struct rcu_data *rdp) if (kvm_check_and_clear_guest_paused()) return; +#ifdef CONFIG_SYSFS + ++rcu_stall_count; +#endif + rcu_stall_notifier_call_chain(RCU_STALL_NOTIFY_NORM, (void *)j - gps); if (READ_ONCE(csd_lock_suppress_rcu_stall) && csd_lock_is_stuck()) { pr_err("INFO: %s detected stall, but suppressed full report due to a stuck CSD-lock.\n", rcu_state.name); |
