summaryrefslogtreecommitdiff
path: root/sys-kernel/linux-image-redcore-lts/files/4.19-0007-Convert-msleep-to-use-hrtimers-when-active.patch
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2019-02-09 20:03:56 +0000
committerV3n3RiX <venerix@redcorelinux.org>2019-02-09 20:03:56 +0000
commit42672d73de4fab730a2d6e91c92d19afebeb40bb (patch)
tree75f994204990d5dc91f836f1312406ec4b560105 /sys-kernel/linux-image-redcore-lts/files/4.19-0007-Convert-msleep-to-use-hrtimers-when-active.patch
parentc3bbcf0672c7f05a24ba5869129ab012396870b2 (diff)
sys-kernel/linux-{image,sources}-redcore-lts : version bump to v4.14.95 && v4.19.20
Diffstat (limited to 'sys-kernel/linux-image-redcore-lts/files/4.19-0007-Convert-msleep-to-use-hrtimers-when-active.patch')
-rw-r--r--sys-kernel/linux-image-redcore-lts/files/4.19-0007-Convert-msleep-to-use-hrtimers-when-active.patch54
1 files changed, 54 insertions, 0 deletions
diff --git a/sys-kernel/linux-image-redcore-lts/files/4.19-0007-Convert-msleep-to-use-hrtimers-when-active.patch b/sys-kernel/linux-image-redcore-lts/files/4.19-0007-Convert-msleep-to-use-hrtimers-when-active.patch
new file mode 100644
index 00000000..e9edcd12
--- /dev/null
+++ b/sys-kernel/linux-image-redcore-lts/files/4.19-0007-Convert-msleep-to-use-hrtimers-when-active.patch
@@ -0,0 +1,54 @@
+From 7b74daf29a88f3314af306509bd40d45c34f11c7 Mon Sep 17 00:00:00 2001
+From: Con Kolivas <kernel@kolivas.org>
+Date: Fri, 4 Nov 2016 09:25:54 +1100
+Subject: [PATCH 07/16] Convert msleep to use hrtimers when active.
+
+---
+ kernel/time/timer.c | 24 ++++++++++++++++++++++--
+ 1 file changed, 22 insertions(+), 2 deletions(-)
+
+diff --git a/kernel/time/timer.c b/kernel/time/timer.c
+index ae942d459aa2..542c13d98950 100644
+--- a/kernel/time/timer.c
++++ b/kernel/time/timer.c
+@@ -1965,7 +1965,19 @@ void __init init_timers(void)
+ */
+ void msleep(unsigned int msecs)
+ {
+- unsigned long timeout = msecs_to_jiffies(msecs) + 1;
++ int jiffs = msecs_to_jiffies(msecs);
++ unsigned long timeout;
++
++ /*
++ * Use high resolution timers where the resolution of tick based
++ * timers is inadequate.
++ */
++ if (jiffs < 5 && hrtimer_resolution < NSEC_PER_SEC / HZ) {
++ while (msecs)
++ msecs = schedule_msec_hrtimeout_uninterruptible(msecs);
++ return;
++ }
++ timeout = msecs_to_jiffies(msecs) + 1;
+
+ while (timeout)
+ timeout = schedule_timeout_uninterruptible(timeout);
+@@ -1979,7 +1991,15 @@ EXPORT_SYMBOL(msleep);
+ */
+ unsigned long msleep_interruptible(unsigned int msecs)
+ {
+- unsigned long timeout = msecs_to_jiffies(msecs) + 1;
++ int jiffs = msecs_to_jiffies(msecs);
++ unsigned long timeout;
++
++ if (jiffs < 5 && hrtimer_resolution < NSEC_PER_SEC / HZ) {
++ while (msecs && !signal_pending(current))
++ msecs = schedule_msec_hrtimeout_interruptible(msecs);
++ return msecs;
++ }
++ timeout = msecs_to_jiffies(msecs) + 1;
+
+ while (timeout && !signal_pending(current))
+ timeout = schedule_timeout_interruptible(timeout);
+--
+2.17.1
+