From: Greg Kroah-Hartman Date: Tue, 20 Feb 2024 15:20:53 +0000 (+0100) Subject: 5.10-stable patches X-Git-Tag: v4.19.307~56 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=06ecd1205974496a89938b7e8c40153d736203fa;p=thirdparty%2Fkernel%2Fstable-queue.git 5.10-stable patches added patches: hrtimer-ignore-slack-time-for-rt-tasks-in-schedule_hrtimeout_range.patch --- diff --git a/queue-5.10/hrtimer-ignore-slack-time-for-rt-tasks-in-schedule_hrtimeout_range.patch b/queue-5.10/hrtimer-ignore-slack-time-for-rt-tasks-in-schedule_hrtimeout_range.patch new file mode 100644 index 00000000000..0aa1422df05 --- /dev/null +++ b/queue-5.10/hrtimer-ignore-slack-time-for-rt-tasks-in-schedule_hrtimeout_range.patch @@ -0,0 +1,68 @@ +From 0c52310f260014d95c1310364379772cb74cf82d Mon Sep 17 00:00:00 2001 +From: Davidlohr Bueso +Date: Mon, 23 Jan 2023 09:32:06 -0800 +Subject: hrtimer: Ignore slack time for RT tasks in schedule_hrtimeout_range() + +From: Davidlohr Bueso + +commit 0c52310f260014d95c1310364379772cb74cf82d upstream. + +While in theory the timer can be triggered before expires + delta, for the +cases of RT tasks they really have no business giving any lenience for +extra slack time, so override any passed value by the user and always use +zero for schedule_hrtimeout_range() calls. Furthermore, this is similar to +what the nanosleep(2) family already does with current->timer_slack_ns. + +Signed-off-by: Davidlohr Bueso +Signed-off-by: Thomas Gleixner +Link: https://lore.kernel.org/r/20230123173206.6764-3-dave@stgolabs.net +Signed-off-by: Felix Moessbauer +Signed-off-by: Greg Kroah-Hartman +--- + kernel/time/hrtimer.c | 14 +++++++++++--- + 1 file changed, 11 insertions(+), 3 deletions(-) + +--- a/kernel/time/hrtimer.c ++++ b/kernel/time/hrtimer.c +@@ -2164,7 +2164,7 @@ void __init hrtimers_init(void) + /** + * schedule_hrtimeout_range_clock - sleep until timeout + * @expires: timeout value (ktime_t) +- * @delta: slack in expires timeout (ktime_t) ++ * @delta: slack in expires timeout (ktime_t) for SCHED_OTHER tasks + * @mode: timer mode + * @clock_id: timer clock to be used + */ +@@ -2191,6 +2191,13 @@ schedule_hrtimeout_range_clock(ktime_t * + return -EINTR; + } + ++ /* ++ * Override any slack passed by the user if under ++ * rt contraints. ++ */ ++ if (rt_task(current)) ++ delta = 0; ++ + hrtimer_init_sleeper_on_stack(&t, clock_id, mode); + hrtimer_set_expires_range_ns(&t.timer, *expires, delta); + hrtimer_sleeper_start_expires(&t, mode); +@@ -2210,7 +2217,7 @@ EXPORT_SYMBOL_GPL(schedule_hrtimeout_ran + /** + * schedule_hrtimeout_range - sleep until timeout + * @expires: timeout value (ktime_t) +- * @delta: slack in expires timeout (ktime_t) ++ * @delta: slack in expires timeout (ktime_t) for SCHED_OTHER tasks + * @mode: timer mode + * + * Make the current task sleep until the given expiry time has +@@ -2218,7 +2225,8 @@ EXPORT_SYMBOL_GPL(schedule_hrtimeout_ran + * the current task state has been set (see set_current_state()). + * + * The @delta argument gives the kernel the freedom to schedule the +- * actual wakeup to a time that is both power and performance friendly. ++ * actual wakeup to a time that is both power and performance friendly ++ * for regular (non RT/DL) tasks. + * The kernel give the normal best effort behavior for "@expires+@delta", + * but may decide to fire the timer earlier, but no earlier than @expires. + * diff --git a/queue-5.10/series b/queue-5.10/series index 22299d961e1..255523b08f0 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -366,3 +366,4 @@ scripts-decode_stacktrace-demangle-rust-symbols.patch scripts-decode_stacktrace.sh-optionally-use-llvm-uti.patch netfilter-ipset-fix-performance-regression-in-swap-operation.patch netfilter-ipset-missing-gc-cancellations-fixed.patch +hrtimer-ignore-slack-time-for-rt-tasks-in-schedule_hrtimeout_range.patch