diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2019-12-31 06:06:27 +0000 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2019-12-31 06:06:27 +0000 |
commit | 4b32f160bc40db2f938ace7c46675aae1e555757 (patch) | |
tree | 82cb3cc5e087b587151a3dfdb341f16e389f831a /sys-kernel/linux-image-redcore/files/5.4-0005-Special-case-calls-of-schedule_timeout-1-to-use-the-.patch | |
parent | 03aeee4f84e9c065db81e0eff914fe7ba8ae7d30 (diff) |
sys-kernel/linux-{image,sources}-redcore : version bump to v5.4.5, enable aditional hardening options
Diffstat (limited to 'sys-kernel/linux-image-redcore/files/5.4-0005-Special-case-calls-of-schedule_timeout-1-to-use-the-.patch')
-rw-r--r-- | sys-kernel/linux-image-redcore/files/5.4-0005-Special-case-calls-of-schedule_timeout-1-to-use-the-.patch | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/sys-kernel/linux-image-redcore/files/5.4-0005-Special-case-calls-of-schedule_timeout-1-to-use-the-.patch b/sys-kernel/linux-image-redcore/files/5.4-0005-Special-case-calls-of-schedule_timeout-1-to-use-the-.patch new file mode 100644 index 00000000..53ac287e --- /dev/null +++ b/sys-kernel/linux-image-redcore/files/5.4-0005-Special-case-calls-of-schedule_timeout-1-to-use-the-.patch @@ -0,0 +1,49 @@ +From ea1ace768425220e605f405f36560a4a6d2b0859 Mon Sep 17 00:00:00 2001 +From: Con Kolivas <kernel@kolivas.org> +Date: Sat, 5 Nov 2016 09:27:36 +1100 +Subject: [PATCH 05/16] Special case calls of schedule_timeout(1) to use the + min hrtimeout of 1ms, working around low Hz resolutions. + +--- + kernel/time/timer.c | 16 ++++++++++++++-- + 1 file changed, 14 insertions(+), 2 deletions(-) + +diff --git a/kernel/time/timer.c b/kernel/time/timer.c +index 7dcadf9cd865..212931d29762 100644 +--- a/kernel/time/timer.c ++++ b/kernel/time/timer.c +@@ -1892,6 +1892,18 @@ signed long __sched schedule_timeout(signed long timeout) + + expire = timeout + jiffies; + ++#ifdef CONFIG_HIGH_RES_TIMERS ++ if (timeout == 1 && hrtimer_resolution < NSEC_PER_SEC / HZ) { ++ /* ++ * Special case 1 as being a request for the minimum timeout ++ * and use highres timers to timeout after 1ms to workaround ++ * the granularity of low Hz tick timers. ++ */ ++ if (!schedule_min_hrtimeout()) ++ return 0; ++ goto out_timeout; ++ } ++#endif + timer.task = current; + timer_setup_on_stack(&timer.timer, process_timeout, 0); + __mod_timer(&timer.timer, expire, 0); +@@ -1900,10 +1912,10 @@ signed long __sched schedule_timeout(signed long timeout) + + /* Remove the timer from the object tracker */ + destroy_timer_on_stack(&timer.timer); +- ++out_timeout: + timeout = expire - jiffies; + +- out: ++out: + return timeout < 0 ? 0 : timeout; + } + EXPORT_SYMBOL(schedule_timeout); +-- +2.20.1 + |