rseq: Add prctl() to enable time slice extensions

Implement a prctl() so that tasks can enable the time slice extension
mechanism. This fails, when time slice extensions are disabled at compile
time or on the kernel command line and when no rseq pointer is registered
in the kernel.

That allows to implement a single trivial check in the exit to user mode
hotpath, to decide whether the whole mechanism needs to be invoked.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20251215155708.858717691@linutronix.de
This commit is contained in:
Thomas Gleixner
2025-12-15 17:52:12 +01:00
committed by Peter Zijlstra
parent b5b8282441
commit 28621ec2d4
4 changed files with 77 additions and 0 deletions

View File

@@ -386,4 +386,14 @@ struct prctl_mm_map {
# define PR_FUTEX_HASH_SET_SLOTS 1
# define PR_FUTEX_HASH_GET_SLOTS 2
/* RSEQ time slice extensions */
#define PR_RSEQ_SLICE_EXTENSION 79
# define PR_RSEQ_SLICE_EXTENSION_GET 1
# define PR_RSEQ_SLICE_EXTENSION_SET 2
/*
* Bits for RSEQ_SLICE_EXTENSION_GET/SET
* PR_RSEQ_SLICE_EXT_ENABLE: Enable
*/
# define PR_RSEQ_SLICE_EXT_ENABLE 0x01
#endif /* _LINUX_PRCTL_H */