[RFC PATCH] sysfs: Add /sys/kernel/realtime entry
Sebastian Andrzej Siewior <[email protected]> Thu, 9 Jul 2026 16:31:08 +0200
| Newsgroups | org.kernel.vger.linux-rt-users,dev.linux.lists.driver-core,dev.linux.lists.linux-rt-devel |
|---|---|
| Message-ID | <[email protected]> |
Hi, The following patch sat in the RT queue for almost 15years now. I can't find its origin on the list. All it does is adding /sys/kernel/realtime once PREEMPT_RT is enabled and returns 1. Is this something that is still wanted and considered useful? Is this something that can be expressed better by other means? There was an in person discussion about this and it was suggested to add /sys/kernel/realtime as a folder and having individual realtime features as files. I don't remember a single feature that would quality for this today but who knows. This is all I remember so far. Now. Discussion go! ---------------------8>------------------------- From: Clark Williams <[email protected]> Date: Sat, 30 Jul 2011 21:55:53 -0500 Add a /sys/kernel entry to indicate that the kernel is a realtime kernel. Clark says that he needs this for udev rules, udev needs to evaluate if its a PREEMPT_RT kernel a few thousand times and parsing uname output is too slow or so. Are there better solutions? Should it exist and return 0 on !-rt? Signed-off-by: Clark Williams <[email protected]> Signed-off-by: Peter Zijlstra <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> --- kernel/ksysfs.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c index f45ade718054a..670a7a57d7b23 100644 --- a/kernel/ksysfs.c +++ b/kernel/ksysfs.c @@ -133,6 +133,15 @@ KERNEL_ATTR_RO(vmcoreinfo); #endif /* CONFIG_VMCORE_INFO */ +#if defined(CONFIG_PREEMPT_RT) +static ssize_t realtime_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + return sprintf(buf, "%d\n", 1); +} +KERNEL_ATTR_RO(realtime); +#endif + /* whether file capabilities are enabled */ static ssize_t fscaps_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) @@ -206,6 +215,9 @@ static struct attribute * kernel_attrs[] = { #ifndef CONFIG_TINY_RCU &rcu_expedited_attr.attr, &rcu_normal_attr.attr, +#endif +#ifdef CONFIG_PREEMPT_RT + &realtime_attr.attr, #endif NULL }; -- 2.53.0