]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
rseq: Lower default slice extension
authorPeter Zijlstra <peterz@infradead.org>
Wed, 21 Jan 2026 13:25:04 +0000 (14:25 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Thu, 22 Jan 2026 10:11:20 +0000 (11:11 +0100)
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.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20260121143208.073200729@infradead.org
Documentation/userspace-api/rseq.rst
kernel/rseq.c

index 29af6c300396cbb68c52c90fdb206877ba06da86..468f6bbe0e25f9e874454264332e376c51f56a1f 100644 (file)
@@ -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.
 
index e423a9bc0a2c45a83a89dcce25b6ca701a3a82bd..b0973d19f366efdf14a8fcfb2bd4806b9985a1e8 100644 (file)
@@ -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);