rseq: Various slice-ext changes
Subsystems (4)
Peter Zijlstra
maintainercover rseq: Various slice-ext changes
Hi!
On top of the patches from Thomas:
https://lkml.kernel.org/r/[email protected]
The combined set can be found in:
git://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git sched/core
and I am planning to push that into tip/sched/core in the next few days.
Peter Zijlstra
maintainerPATCH 1/5 rseq: Allow registering RSEQ with slice extension
Since glibc cares about the number of syscalls required to initialize a new thread, allow initializing rseq with slice extension on. This avoids having to do another prctl().
--- include/uapi/linux/rseq.h | 3 ++- kernel/rseq.c | 12 ++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-)
include/uapi/linux/rseq.h +2 -1
@@ -19,7 +19,8 @@ enum rseq_cpu_id_state { };enum rseq_flags { -RSEQ_FLAG_UNREGISTER = (1 <<0 ), +RSEQ_FLAG_UNREGISTER = (1 <<0 ), +RSEQ_FLAG_SLICE_EXT_DEFAULT_ON = (1 <<1 ), };enum rseq_cs_flags_bit {
kernel/rseq.c +10 -2
@@ -424,7 +424,7 @@ SYSCALL_DEFINE4(rseq, struct rseq __userreturn 0 ; } -if (unlikely (flags)) +if (unlikely (flags & ~(RSEQ_FLAG_SLICE_EXT_DEFAULT_ON )))return -EINVAL ;if (current->rseq.usrptr) {
@@ -459,8 +459,12 @@ SYSCALL_DEFINE4(rseq, struct rseq __userif (!access_ok (rseq, rseq_len))return -EFAULT ; -if (IS_ENABLED (CONFIG_RSEQ_SLICE_EXTENSION )) +if (IS_ENABLED (CONFIG_RSEQ_SLICE_EXTENSION )) { rseqfl |=RSEQ_CS_FLAG_SLICE_EXT_AVAILABLE ; +if (rseq_slice_extension_enabled () && + (flags &RSEQ_FLAG_SLICE_EXT_DEFAULT_ON )) + rseqfl |=RSEQ_CS_FLAG_SLICE_EXT_ENABLED ; + } scoped_user_write_access(rseq, efault) {/*
@@ -488,6 +492,10 @@ SYSCALL_DEFINE4(rseq, struct rseq __user current->rseq.len = rseq_len; current->rseq.sig = sig; +#ifdef CONFIG_RSEQ_SLICE_EXTENSION + current->rseq.slice.state.enabled = !!(rseqfl &RSEQ_CS_FLAG_SLICE_EXT_ENABLED ); +#endif +/* * If rseq was previously inactive, and has just been * registered, ensure the cpu_id_start and cpu_id fields
[tip: sched/core] rseq: Allow registering RSEQ with slice extension
The following commit has been merged into the sched/core branch of tip:
The following commit has been merged into the sched/core branch of tip:
Commit-ID: d6200245c75e832af2087bc60ba2e6641a90eee9 Gitweb: https://git.kernel.org/tip/d6200245c75e832af2087bc60ba2e6641a90eee9 Author: Peter Zijlstra <[email protected]> AuthorDate: Mon, 19 Jan 2026 11:23:57 +01:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Thu, 22 Jan 2026 11:11:19 +01:00
rseq: Allow registering RSEQ with slice extension
Since glibc cares about the number of syscalls required to initialize a new thread, allow initializing rseq with slice extension on. This avoids having to do another prctl().
--- include/uapi/linux/rseq.h | 3 ++- kernel/rseq.c | 12 ++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-)
include/uapi/linux/rseq.h +2 -1
@@ -19,7 +19,8 @@ enum rseq_cpu_id_state { };enum rseq_flags { -RSEQ_FLAG_UNREGISTER = (1 <<0 ), +RSEQ_FLAG_UNREGISTER = (1 <<0 ), +RSEQ_FLAG_SLICE_EXT_DEFAULT_ON = (1 <<1 ), };enum rseq_cs_flags_bit {
kernel/rseq.c +10 -2
@@ -424,7 +424,7 @@ SYSCALL_DEFINE4(rseq, struct rseq __user *, rseq, u32, rseq_len, int, flags, u32return 0 ; } -if (unlikely (flags)) +if (unlikely (flags & ~(RSEQ_FLAG_SLICE_EXT_DEFAULT_ON )))return -EINVAL ;if (current->rseq.usrptr) {
@@ -459,8 +459,12 @@ SYSCALL_DEFINE4(rseq, struct rseq __user *, rseq, u32, rseq_len, int, flags, u32if (!access_ok (rseq, rseq_len))return -EFAULT ; -if (IS_ENABLED (CONFIG_RSEQ_SLICE_EXTENSION )) +if (IS_ENABLED (CONFIG_RSEQ_SLICE_EXTENSION )) { rseqfl |=RSEQ_CS_FLAG_SLICE_EXT_AVAILABLE ; +if (rseq_slice_extension_enabled () && + (flags &RSEQ_FLAG_SLICE_EXT_DEFAULT_ON )) + rseqfl |=RSEQ_CS_FLAG_SLICE_EXT_ENABLED ; + } scoped_user_write_access(rseq, efault) {/*
@@ -488,6 +492,10 @@ SYSCALL_DEFINE4(rseq, struct rseq __user *, rseq, u32, rseq_len, int, flags, u32 current->rseq.len = rseq_len; current->rseq.sig = sig; +#ifdef CONFIG_RSEQ_SLICE_EXTENSION + current->rseq.slice.state.enabled = !!(rseqfl &RSEQ_CS_FLAG_SLICE_EXT_ENABLED ); +#endif +/* * If rseq was previously inactive, and has just been * registered, ensure the cpu_id_start and cpu_id fields
Peter Zijlstra
maintainerPATCH 2/5 rseq: Move slice_ext_nsec to debugfs
In reply to Peter ZijlstraMove changing the slice ext duration to debugfs, a sliglty less permanent interface.
--- Documentation/admin-guide/sysctl/kernel.rst | 11 ---- Documentation/userspace-api/rseq.rst | 4 + kernel/rseq.c | 69 +++++++++++++++++++--------- 3 files changed, 51 insertions(+), 33 deletions(-)
Documentation/admin-guide/sysctl/kernel.rst +0 -11
@@ -1248,17 +1248,6 @@ reboot-cmd (SPARC only) ROM/Flash boot loader. Maybe to tell it what to do after rebooting. ??? -rseq_slice_extension_nsec -========================= - -A task can request to delay its scheduling if it is in a critical section -via the prctl(PR_RSEQ_SLICE_EXTENSION_SET) mechanism. This sets the maximum -allowed extension in nanoseconds before scheduling of the task is enforced. -Default value is 10000ns (10us). The possible range is 10000ns (10us) to -50000ns (50us). - -This value has a direct correlation to the worst case scheduling latency; -increment at your own risk. sched_energy_aware ==================
Documentation/userspace-api/rseq.rst +3 -1
@@ -79,7 +79,9 @@ slice extension by setting rseq::slice_c interrupted and the interrupt results in a reschedule request in the kernel, then the kernel can grant a time slice extension and return to userspace instead of scheduling out. The length of the extension is -determined by the ``rseq_slice_extension_nsec`` sysctl. +determined by debugfs:rseq/slice_ext_nsec. The default value is 10 usec; which +is the minimum value. It can be incremented to 50 usecs, however doing so +can/will affect the minimum scheduling latency. The kernel indicates the grant by clearing rseq::slice_ctrl::request and setting rseq::slice_ctrl::granted to 1. If there is a reschedule of the
kernel/rseq.c +48 -21
104 lines not on this page · raw message
Re: [PATCH 2/5] rseq: Move slice_ext_nsec to debugfs
Quoted 5 lines · Peter Zijlstra
Move changing the slice ext duration to debugfs, a sliglty less permanent interface.
Signed-off-by Peter Zijlstra (Intel) <[email protected]>---
(...)
kernel/rseq.c static const struct file_operations debu · line 225
Quoted 7 lines
kernel/rseq.c +1
-0@@ -222,12 +222,16 @@ static const struct file_operations debu .release = single_release, }; +extern void rseq_slice_ext_init (struct dentry *root_dir);
This is actually a static function.
kernel/rseq.c static const struct file_operations debu · line 233
Quoted 8 lines
kernel/rseq.c +2
-0+static int __init rseq_debugfs_init (void ) {struct dentry *root_dir =debugfs_create_dir ("rseq" ,NULL );debugfs_create_file ("debug" ,0644 , root_dir,NULL , &debug_ops);rseq_stats_init (root_dir); +if (IS_ENABLED (CONFIG_RSEQ_SLICE_EXTENSIO ))
Missing 'N' at the end.
Quoted 7 lines
kernel/rseq.c +1
-0+rseq_slice_ext_init (root_dir);return 0 ; }__initcall (rseq_debugfs_init);@@ -515,7 +519,9 @@ struct slice_timer {void *cookie; };
(...)
Quoted 1 line
+#ifdef
CONFIG_DEBUG_FS
(...)
kernel/rseq.c SYSCALL_DEFINE0(rseq_slice_yield) · line 815
Quoted 3 lines
kernel/rseq.c +3
-0+#else +static void rseq_slice_ext_init (struct dentry *root_dir) { } +#endif
It might be possible to just remove the CONFIG_DEBUG_FS ifdeffery and let the compiler optimize away all of the debugfs-related code automatically.
(...)
Peter Zijlstra
maintainerRe: [PATCH 2/5] rseq: Move slice_ext_nsec to debugfs
Quoted 15 lines · Thomas Weißschuh
Quoted 5 lines · Peter Zijlstra
Move changing the slice ext duration to debugfs, a sliglty less permanent interface.
Signed-off-by Peter Zijlstra (Intel) <[email protected]>---
(...)
Quoted 6 lines
kernel/rseq.c +0
-0@@ -222,12 +222,16 @@ static const struct file_operations debu .release = single_release, };
Quoted 3 lines
kernel/rseq.c static const struct file_operations debu · line 225
Quoted 1 line
kernel/rseq.c +1
-0+extern void rseq_slice_ext_init (struct dentry *root_dir);This is actually a static function.
Yes, but it is not always defined.
Quoted 10 lines
kernel/rseq.c static const struct file_operations debu · line 233
Quoted 8 lines
kernel/rseq.c +2
-0+static int __init rseq_debugfs_init (void ) {struct dentry *root_dir =debugfs_create_dir ("rseq" ,NULL );debugfs_create_file ("debug" ,0644 , root_dir,NULL , &debug_ops);rseq_stats_init (root_dir); +if (IS_ENABLED (CONFIG_RSEQ_SLICE_EXTENSIO ))Missing 'N' at the end.
Argh. Some day my editor will tell me this :/
Quoted 12 lines
Quoted 7 lines
kernel/rseq.c +1
-0+rseq_slice_ext_init (root_dir);return 0 ; }__initcall (rseq_debugfs_init);@@ -515,7 +519,9 @@ struct slice_timer {void *cookie; };(...)
Quoted 1 line
+#ifdef
CONFIG_DEBUG_FS
Quoted 8 lines
(...)
kernel/rseq.c SYSCALL_DEFINE0(rseq_slice_yield) · line 815
Quoted 3 lines
kernel/rseq.c +3
-0+#else +static void rseq_slice_ext_init (struct dentry *root_dir) { } +#endif It might be possible to just remove the
CONFIG_DEBUG_FSifdeffery and let the compiler optimize away all of the debugfs-related code automatically.
I'll check.
Peter Zijlstra
maintainerRe: [PATCH 2/5] rseq: Move slice_ext_nsec to debugfs
In reply to Thomas WeißschuhQuoted 6 lines · Thomas Weißschuh
Review
Quoted 3 lines
(quoted diff) +3
-0+#else +static void rseq_slice_ext_init(struct dentry *root_dir) { } +#endifIt might be possible to just remove the
CONFIG_DEBUG_FSifdeffery and let the compiler optimize away all of the debugfs-related code automatically.
Something like the below seems to actually build for SLICE_EXT=y, DEBUG_FS=n (got there through allnoconfig)
Final image doesn't seem to have the various _ops,_show etc symbols either.
kernel/rseq.c +3 -7
@@ -123,7 +123,6 @@ void __rseq_trace_ip_fixup(unsigned long }#endif /* CONFIG_TRACEPOINTS */ -#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_RSEQ_STATS DEFINE_PER_CPU(struct rseq_stats, rseq_stats);
@@ -222,7 +221,7 @@ static const struct file_operations debu .release = single_release, }; -extern void rseq_slice_ext_init (struct dentry *root_dir); +static void rseq_slice_ext_init (struct dentry *root_dir);static int __init rseq_debugfs_init (void ) {
@@ -235,7 +234,6 @@ static int __init rseq_debugfs_init(voidreturn 0 ; }__initcall (rseq_debugfs_init); -#endif /* CONFIG_DEBUG_FS */ static bool rseq_set_ids (struct task_struct *t,struct rseq_ids *ids,u32 node_id) {
@@ -767,7 +765,6 @@ SYSCALL_DEFINE0(rseq_slice_yield)return yielded; } -#ifdef CONFIG_DEBUG_FS static int rseq_slice_ext_show (struct seq_file *m,void *p) {seq_printf (m,"%d\n" , rseq_slice_ext_nsecs);
@@ -810,9 +807,6 @@ static void rseq_slice_ext_init(struct d {debugfs_create_file ("slice_ext_nsec" ,0644 , root_dir,NULL , &slice_ext_ops); } -#else -static void rseq_slice_ext_init (struct dentry *root_dir) { } -#endif static int __init rseq_slice_cmdline (char *str) {
@@ -838,4 +832,6 @@ static int __init rseq_slice_init(void) return 0; }device_initcall (rseq_slice_init); +#else +static void rseq_slice_ext_init (struct dentry *root_dir) { }#endif /* CONFIG_RSEQ_SLICE_EXTENSION */
[tip: sched/core] rseq: Move slice_ext_nsec to debugfs
In reply to Peter ZijlstraThe following commit has been merged into the sched/core branch of tip:
The following commit has been merged into the sched/core branch of tip:
Commit-ID: e1d7f54900f1e1d3003a85b78cd7105a64203ff7 Gitweb: https://git.kernel.org/tip/e1d7f54900f1e1d3003a85b78cd7105a64203ff7 Author: Peter Zijlstra <[email protected]> AuthorDate: Wed, 21 Jan 2026 14:21:51 +01:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Thu, 22 Jan 2026 11:11:20 +01:00
rseq: Move slice_ext_nsec to debugfs
Move changing the slice ext duration to debugfs, a sliglty less permanent interface.
--- Documentation/admin-guide/sysctl/kernel.rst | 11 +--- Documentation/userspace-api/rseq.rst | 4 +- kernel/rseq.c | 69 +++++++++++++------- 3 files changed, 49 insertions(+), 35 deletions(-)
Documentation/admin-guide/sysctl/kernel.rst +0 -11
@@ -1248,17 +1248,6 @@ reboot-cmd (SPARC only) ROM/Flash boot loader. Maybe to tell it what to do after rebooting. ??? -rseq_slice_extension_nsec -========================= - -A task can request to delay its scheduling if it is in a critical section -via the prctl(PR_RSEQ_SLICE_EXTENSION_SET) mechanism. This sets the maximum -allowed extension in nanoseconds before scheduling of the task is enforced. -Default value is 10000ns (10us). The possible range is 10000ns (10us) to -50000ns (50us). - -This value has a direct correlation to the worst case scheduling latency; -increment at your own risk. sched_energy_aware ==================
Documentation/userspace-api/rseq.rst +3 -1
@@ -79,7 +79,9 @@ slice extension by setting rseq::slice_ctrl::request to 1. If the thread is interrupted and the interrupt results in a reschedule request in the kernel, then the kernel can grant a time slice extension and return to userspace instead of scheduling out. The length of the extension is -determined by the ``rseq_slice_extension_nsec`` sysctl. +determined by debugfs:rseq/slice_ext_nsec. The default value is 10 usec; which +is the minimum value. It can be incremented to 50 usecs, however doing so +can/will affect the minimum scheduling latency. The kernel indicates the grant by clearing rseq::slice_ctrl::request and setting rseq::slice_ctrl::granted to 1. If there is a reschedule of the
kernel/rseq.c +46 -23
114 lines not on this page · raw message
Peter Zijlstra
maintainerPATCH 3/5 rseq: Lower default slice extension
In reply to Peter ZijlstraChange the minimum slice extension to 5 usec.
Since slice_test selftest reaches a staggering ~350 nsec extension:
Task: slice_test Mean: 350.266 ns
Latency (us) | Count
------------------------------
EXPIRED | 238 0 us | 143189 1 us | 167 2 us | 26 3 us | 11 4 us | 28 5 us | 31 6 us | 22 7 us | 23 8 us | 32 9 us | 16 10 us | 35
Lower the minimal (and default) value to 5 usecs -- which is still massive.
--- Documentation/userspace-api/rseq.rst | 2 +- kernel/rseq.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Documentation/userspace-api/rseq.rst +1 -1
@@ -79,7 +79,7 @@ slice extension by setting rseq::slice_c interrupted and the interrupt results in a reschedule request in the kernel, then the kernel can grant a time slice extension and return to userspace instead of scheduling out. The length of the extension is -determined by debugfs:rseq/slice_ext_nsec. The default value is 10 usec; which +determined by debugfs:rseq/slice_ext_nsec. The default value is 5 usec; which is the minimum value. It can be incremented to 50 usecs, however doing so can/will affect the minimum scheduling latency.
kernel/rseq.c +1 -1
@@ -519,7 +519,7 @@ struct slice_timer {void *cookie; }; -static const unsigned int rseq_slice_ext_nsecs_min =10 *NSEC_PER_USEC ; +static const unsigned int rseq_slice_ext_nsecs_min =5 *NSEC_PER_USEC ;static const unsigned int rseq_slice_ext_nsecs_max =50 *NSEC_PER_USEC ;unsigned int rseq_slice_ext_nsecs__read_mostly = rseq_slice_ext_nsecs_min; static DEFINE_PER_CPU(struct slice_timer, slice_timer);
[tip: sched/core] rseq: Lower default slice extension
The following commit has been merged into the sched/core branch of tip:
The following commit has been merged into the sched/core branch of tip:
Commit-ID: 21c0e92d0681fbd10ac024311bd09bca439e0bb1 Gitweb: https://git.kernel.org/tip/21c0e92d0681fbd10ac024311bd09bca439e0bb1 Author: Peter Zijlstra <[email protected]> AuthorDate: Wed, 21 Jan 2026 14:25:04 +01:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Thu, 22 Jan 2026 11:11:20 +01:00
rseq: Lower default slice extension
Change the minimum slice extension to 5 usec.
Since slice_test selftest reaches a staggering ~350 nsec extension:
Task: slice_test Mean: 350.266 ns
Latency (us) | Count
------------------------------
EXPIRED | 238 0 us | 143189 1 us | 167 2 us | 26 3 us | 11 4 us | 28 5 us | 31 6 us | 22 7 us | 23 8 us | 32 9 us | 16 10 us | 35
Lower the minimal (and default) value to 5 usecs -- which is still massive.
--- Documentation/userspace-api/rseq.rst | 2 +- kernel/rseq.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Documentation/userspace-api/rseq.rst +1 -1
@@ -79,7 +79,7 @@ slice extension by setting rseq::slice_ctrl::request to 1. If the thread is interrupted and the interrupt results in a reschedule request in the kernel, then the kernel can grant a time slice extension and return to userspace instead of scheduling out. The length of the extension is -determined by debugfs:rseq/slice_ext_nsec. The default value is 10 usec; which +determined by debugfs:rseq/slice_ext_nsec. The default value is 5 usec; which is the minimum value. It can be incremented to 50 usecs, however doing so can/will affect the minimum scheduling latency.
kernel/rseq.c +1 -1
@@ -517,7 +517,7 @@ struct slice_timer {void *cookie; }; -static const unsigned int rseq_slice_ext_nsecs_min =10 *NSEC_PER_USEC ; +static const unsigned int rseq_slice_ext_nsecs_min =5 *NSEC_PER_USEC ;static const unsigned int rseq_slice_ext_nsecs_max =50 *NSEC_PER_USEC ;unsigned int rseq_slice_ext_nsecs__read_mostly = rseq_slice_ext_nsecs_min; static DEFINE_PER_CPU(struct slice_timer, slice_timer);
Peter Zijlstra
maintainerPATCH 4/5 hrtimer: Fix trace oddity
In reply to Peter ZijlstraIt turns out that __run_hrtimer() will trace like:
<idle>-0 [032] d.h2. 20705.474563: hrtimer_cancel: hrtimer=0xff2db8f77f8226e8
<idle>-0 [032] d.h1. 20705.474563: hrtimer_expire_entry: hrtimer=0xff2db8f77f8226e8 now=20699452001850 function=tick_nohz_handler/0x0Which is a bit nonsensical, the timer doesn't get canceled on expiration. The cause is the use of the incorrect debug helper.
--- kernel/time/hrtimer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/time/hrtimer.c +1 -1
@@ -1750,7 +1750,7 @@ static void __run_hrtimer(struct hrtimerlockdep_assert_held (&cpu_base->lock); -debug_deactivate (timer); +debug_hrtimer_deactivate (timer); base->running = timer;/*
[tip: sched/core] hrtimer: Fix trace oddity
The following commit has been merged into the sched/core branch of tip:
The following commit has been merged into the sched/core branch of tip:
Commit-ID: 5d6446f409da00e5a389125ddb5ce09f5bc404c9 Gitweb: https://git.kernel.org/tip/5d6446f409da00e5a389125ddb5ce09f5bc404c9 Author: Thomas Gleixner <[email protected]> AuthorDate: Mon, 19 Jan 2026 11:38:34 +01:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Thu, 22 Jan 2026 11:11:20 +01:00
hrtimer: Fix trace oddity
It turns out that __run_hrtimer() will trace like:
<idle>-0 [032] d.h2. 20705.474563: hrtimer_cancel: hrtimer=0xff2db8f77f8226e8
<idle>-0 [032] d.h1. 20705.474563: hrtimer_expire_entry: hrtimer=0xff2db8f77f8226e8 now=20699452001850 function=tick_nohz_handler/0x0Which is a bit nonsensical, the timer doesn't get canceled on expiration. The cause is the use of the incorrect debug helper.
--- kernel/time/hrtimer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/time/hrtimer.c +1 -1
@@ -1742,7 +1742,7 @@ static void __run_hrtimer(struct hrtimer_cpu_base *cpu_base,lockdep_assert_held (&cpu_base->lock); -debug_deactivate (timer); +debug_hrtimer_deactivate (timer); base->running = timer;/*
Peter Zijlstra
maintainerPATCH 5/5 selftests/rseq: Add rseq slice histogram script
In reply to Peter ZijlstraA script that processes trace-cmd data and generates a histogram of rseq slice_ext durations for the recorded workload.
--- Documentation/userspace-api/rseq.rst | 3 tools/testing/selftests/rseq/rseq-slice-hist.py | 132 ++++++++++++++++++++++++ 2 files changed, 135 insertions(+)
Documentation/userspace-api/rseq.rst +3 -0
@@ -83,6 +83,9 @@ determined by debugfs:rseq/slice_ext_nse is the minimum value. It can be incremented to 50 usecs, however doing so can/will affect the minimum scheduling latency. +Any proposed changes to this default will have to come with a selftest and +rseq-slice-hist.py output that shows the new value has merrit. + The kernel indicates the grant by clearing rseq::slice_ctrl::request and setting rseq::slice_ctrl::granted to 1. If there is a reschedule of the thread after granting the extension, the kernel clears the granted bit to
tools/testing/selftests/rseq/rseq-slice-hist.py new file +132 -0
132 lines not on this page · raw message
[tip: sched/core] selftests/rseq: Add rseq slice histogram script
The following commit has been merged into the sched/core branch of tip:
The following commit has been merged into the sched/core branch of tip:
Commit-ID: bb332a9e5a057d2cb9b90e307b26cce9b1f6f660 Gitweb: https://git.kernel.org/tip/bb332a9e5a057d2cb9b90e307b26cce9b1f6f660 Author: Peter Zijlstra <[email protected]> AuthorDate: Wed, 21 Jan 2026 15:10:29 +01:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Thu, 22 Jan 2026 11:11:20 +01:00
selftests/rseq: Add rseq slice histogram script
A script that processes trace-cmd data and generates a histogram of rseq slice_ext durations for the recorded workload.
--- Documentation/userspace-api/rseq.rst | 3 +- tools/testing/selftests/rseq/rseq-slice-hist.py | 132 +++++++++++++++- 2 files changed, 135 insertions(+) create mode 100644 tools/testing/selftests/rseq/rseq-slice-hist.py
Documentation/userspace-api/rseq.rst +3 -0
@@ -83,6 +83,9 @@ determined by debugfs:rseq/slice_ext_nsec. The default value is 5 usec; which is the minimum value. It can be incremented to 50 usecs, however doing so can/will affect the minimum scheduling latency. +Any proposed changes to this default will have to come with a selftest and +rseq-slice-hist.py output that shows the new value has merrit. + The kernel indicates the grant by clearing rseq::slice_ctrl::request and setting rseq::slice_ctrl::granted to 1. If there is a reschedule of the thread after granting the extension, the kernel clears the granted bit to
tools/testing/selftests/rseq/rseq-slice-hist.py new file +132 -0
132 lines not on this page · raw message