blob: 0c60d55118f05223e3f5ca5401de3dba2ab12dca (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
From 619480006f78ebf87d80b73d4085a52a1de56feb Mon Sep 17 00:00:00 2001
From: Martin Borg <martin.borg@enea.com>
Date: Mon, 3 Mar 2014 13:34:43 +0100
Subject: [PATCH 1/2] sched/nohz: Fix overflow error in
scheduler_tick_max_deferment()
---
include/linux/jiffies.h | 4 ++++
kernel/sched/core.c | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index 8fb8edf..ac69959 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -290,6 +290,10 @@ extern unsigned long preset_lpj;
*/
extern unsigned int jiffies_to_msecs(const unsigned long j);
extern unsigned int jiffies_to_usecs(const unsigned long j);
+static inline u64 jiffies_to_nsecs(const unsigned long j)
+{
+ return (u64)jiffies_to_usecs(j) * NSEC_PER_USEC;
+}
extern unsigned long msecs_to_jiffies(const unsigned int m);
extern unsigned long usecs_to_jiffies(const unsigned int u);
extern unsigned long timespec_to_jiffies(const struct timespec *value);
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 59c7367..8c3d8bf 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2779,7 +2779,7 @@ u64 scheduler_tick_max_deferment(void)
if (time_before_eq(next, now))
return 0;
- return jiffies_to_usecs(next - now) * NSEC_PER_USEC;
+ return jiffies_to_nsecs(next - now);
}
static __init int sched_nohz_full_init_debug(void)
--
1.7.10.4
|