diff options
author | Ingo Molnar <mingo@kernel.org> | 2013-04-27 03:16:06 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2013-04-27 03:16:06 -0400 |
commit | a1412ec539e4025831777ef78a1ce427c97bf400 (patch) | |
tree | 765d79c10c08aa7dda0b319fea48cc0c17b95ad0 | |
parent | 47aa8b6cbcb839efe2edaa5b50fee21df115d37b (diff) | |
parent | 8c23b80ec7f1f5405f07bb56c2f8378800ecf401 (diff) |
Merge branch 'timers/nohz-v2' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks into timers/nohz
Pull more full-dynticks updates from Frederic Weisbecker:
* Get rid of the passive dependency on VIRT_CPU_ACCOUNTING_GEN (finally!)
* Preparation patch to remove the dependency on CONFIG_64BITS
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | include/asm-generic/cputime_nsecs.h | 28 | ||||
-rw-r--r-- | init/Kconfig | 6 | ||||
-rw-r--r-- | kernel/time/Kconfig | 4 |
3 files changed, 25 insertions, 13 deletions
diff --git a/include/asm-generic/cputime_nsecs.h b/include/asm-generic/cputime_nsecs.h index a8ece9a33aef..2c9e62c2bfd0 100644 --- a/include/asm-generic/cputime_nsecs.h +++ b/include/asm-generic/cputime_nsecs.h | |||
@@ -16,21 +16,27 @@ | |||
16 | #ifndef _ASM_GENERIC_CPUTIME_NSECS_H | 16 | #ifndef _ASM_GENERIC_CPUTIME_NSECS_H |
17 | #define _ASM_GENERIC_CPUTIME_NSECS_H | 17 | #define _ASM_GENERIC_CPUTIME_NSECS_H |
18 | 18 | ||
19 | #include <linux/math64.h> | ||
20 | |||
19 | typedef u64 __nocast cputime_t; | 21 | typedef u64 __nocast cputime_t; |
20 | typedef u64 __nocast cputime64_t; | 22 | typedef u64 __nocast cputime64_t; |
21 | 23 | ||
22 | #define cputime_one_jiffy jiffies_to_cputime(1) | 24 | #define cputime_one_jiffy jiffies_to_cputime(1) |
23 | 25 | ||
26 | #define cputime_div(__ct, divisor) div_u64((__force u64)__ct, divisor) | ||
27 | #define cputime_div_rem(__ct, divisor, remainder) \ | ||
28 | div_u64_rem((__force u64)__ct, divisor, remainder); | ||
29 | |||
24 | /* | 30 | /* |
25 | * Convert cputime <-> jiffies (HZ) | 31 | * Convert cputime <-> jiffies (HZ) |
26 | */ | 32 | */ |
27 | #define cputime_to_jiffies(__ct) \ | 33 | #define cputime_to_jiffies(__ct) \ |
28 | ((__force u64)(__ct) / (NSEC_PER_SEC / HZ)) | 34 | cputime_div(__ct, NSEC_PER_SEC / HZ) |
29 | #define cputime_to_scaled(__ct) (__ct) | 35 | #define cputime_to_scaled(__ct) (__ct) |
30 | #define jiffies_to_cputime(__jif) \ | 36 | #define jiffies_to_cputime(__jif) \ |
31 | (__force cputime_t)((__jif) * (NSEC_PER_SEC / HZ)) | 37 | (__force cputime_t)((__jif) * (NSEC_PER_SEC / HZ)) |
32 | #define cputime64_to_jiffies64(__ct) \ | 38 | #define cputime64_to_jiffies64(__ct) \ |
33 | ((__force u64)(__ct) / (NSEC_PER_SEC / HZ)) | 39 | cputime_div(__ct, NSEC_PER_SEC / HZ) |
34 | #define jiffies64_to_cputime64(__jif) \ | 40 | #define jiffies64_to_cputime64(__jif) \ |
35 | (__force cputime64_t)((__jif) * (NSEC_PER_SEC / HZ)) | 41 | (__force cputime64_t)((__jif) * (NSEC_PER_SEC / HZ)) |
36 | 42 | ||
@@ -45,7 +51,7 @@ typedef u64 __nocast cputime64_t; | |||
45 | * Convert cputime <-> microseconds | 51 | * Convert cputime <-> microseconds |
46 | */ | 52 | */ |
47 | #define cputime_to_usecs(__ct) \ | 53 | #define cputime_to_usecs(__ct) \ |
48 | ((__force u64)(__ct) / NSEC_PER_USEC) | 54 | cputime_div(__ct, NSEC_PER_USEC) |
49 | #define usecs_to_cputime(__usecs) \ | 55 | #define usecs_to_cputime(__usecs) \ |
50 | (__force cputime_t)((__usecs) * NSEC_PER_USEC) | 56 | (__force cputime_t)((__usecs) * NSEC_PER_USEC) |
51 | #define usecs_to_cputime64(__usecs) \ | 57 | #define usecs_to_cputime64(__usecs) \ |
@@ -55,7 +61,7 @@ typedef u64 __nocast cputime64_t; | |||
55 | * Convert cputime <-> seconds | 61 | * Convert cputime <-> seconds |
56 | */ | 62 | */ |
57 | #define cputime_to_secs(__ct) \ | 63 | #define cputime_to_secs(__ct) \ |
58 | ((__force u64)(__ct) / NSEC_PER_SEC) | 64 | cputime_div(__ct, NSEC_PER_SEC) |
59 | #define secs_to_cputime(__secs) \ | 65 | #define secs_to_cputime(__secs) \ |
60 | (__force cputime_t)((__secs) * NSEC_PER_SEC) | 66 | (__force cputime_t)((__secs) * NSEC_PER_SEC) |
61 | 67 | ||
@@ -69,8 +75,10 @@ static inline cputime_t timespec_to_cputime(const struct timespec *val) | |||
69 | } | 75 | } |
70 | static inline void cputime_to_timespec(const cputime_t ct, struct timespec *val) | 76 | static inline void cputime_to_timespec(const cputime_t ct, struct timespec *val) |
71 | { | 77 | { |
72 | val->tv_sec = (__force u64) ct / NSEC_PER_SEC; | 78 | u32 rem; |
73 | val->tv_nsec = (__force u64) ct % NSEC_PER_SEC; | 79 | |
80 | val->tv_sec = cputime_div_rem(ct, NSEC_PER_SEC, &rem); | ||
81 | val->tv_nsec = rem; | ||
74 | } | 82 | } |
75 | 83 | ||
76 | /* | 84 | /* |
@@ -83,15 +91,17 @@ static inline cputime_t timeval_to_cputime(const struct timeval *val) | |||
83 | } | 91 | } |
84 | static inline void cputime_to_timeval(const cputime_t ct, struct timeval *val) | 92 | static inline void cputime_to_timeval(const cputime_t ct, struct timeval *val) |
85 | { | 93 | { |
86 | val->tv_sec = (__force u64) ct / NSEC_PER_SEC; | 94 | u32 rem; |
87 | val->tv_usec = ((__force u64) ct % NSEC_PER_SEC) / NSEC_PER_USEC; | 95 | |
96 | val->tv_sec = cputime_div_rem(ct, NSEC_PER_SEC, &rem); | ||
97 | val->tv_usec = rem / NSEC_PER_USEC; | ||
88 | } | 98 | } |
89 | 99 | ||
90 | /* | 100 | /* |
91 | * Convert cputime <-> clock (USER_HZ) | 101 | * Convert cputime <-> clock (USER_HZ) |
92 | */ | 102 | */ |
93 | #define cputime_to_clock_t(__ct) \ | 103 | #define cputime_to_clock_t(__ct) \ |
94 | ((__force u64)(__ct) / (NSEC_PER_SEC / USER_HZ)) | 104 | cputime_div(__ct, (NSEC_PER_SEC / USER_HZ)) |
95 | #define clock_t_to_cputime(__x) \ | 105 | #define clock_t_to_cputime(__x) \ |
96 | (__force cputime_t)((__x) * (NSEC_PER_SEC / USER_HZ)) | 106 | (__force cputime_t)((__x) * (NSEC_PER_SEC / USER_HZ)) |
97 | 107 | ||
diff --git a/init/Kconfig b/init/Kconfig index edc8132584f1..8f97a7407714 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
@@ -306,7 +306,7 @@ choice | |||
306 | # Kind of a stub config for the pure tick based cputime accounting | 306 | # Kind of a stub config for the pure tick based cputime accounting |
307 | config TICK_CPU_ACCOUNTING | 307 | config TICK_CPU_ACCOUNTING |
308 | bool "Simple tick based cputime accounting" | 308 | bool "Simple tick based cputime accounting" |
309 | depends on !S390 | 309 | depends on !S390 && !NO_HZ_FULL |
310 | help | 310 | help |
311 | This is the basic tick based cputime accounting that maintains | 311 | This is the basic tick based cputime accounting that maintains |
312 | statistics about user, system and idle time spent on per jiffies | 312 | statistics about user, system and idle time spent on per jiffies |
@@ -316,7 +316,7 @@ config TICK_CPU_ACCOUNTING | |||
316 | 316 | ||
317 | config VIRT_CPU_ACCOUNTING_NATIVE | 317 | config VIRT_CPU_ACCOUNTING_NATIVE |
318 | bool "Deterministic task and CPU time accounting" | 318 | bool "Deterministic task and CPU time accounting" |
319 | depends on HAVE_VIRT_CPU_ACCOUNTING | 319 | depends on HAVE_VIRT_CPU_ACCOUNTING && !NO_HZ_FULL |
320 | select VIRT_CPU_ACCOUNTING | 320 | select VIRT_CPU_ACCOUNTING |
321 | help | 321 | help |
322 | Select this option to enable more accurate task and CPU time | 322 | Select this option to enable more accurate task and CPU time |
@@ -346,7 +346,7 @@ config VIRT_CPU_ACCOUNTING_GEN | |||
346 | 346 | ||
347 | config IRQ_TIME_ACCOUNTING | 347 | config IRQ_TIME_ACCOUNTING |
348 | bool "Fine granularity task level IRQ time accounting" | 348 | bool "Fine granularity task level IRQ time accounting" |
349 | depends on HAVE_IRQ_TIME_ACCOUNTING | 349 | depends on HAVE_IRQ_TIME_ACCOUNTING && !NO_HZ_FULL |
350 | help | 350 | help |
351 | Select this option to enable fine granularity task irq time | 351 | Select this option to enable fine granularity task irq time |
352 | accounting. This is done by reading a timestamp on each | 352 | accounting. This is done by reading a timestamp on each |
diff --git a/kernel/time/Kconfig b/kernel/time/Kconfig index 1ea2bba4a686..a2ddd650cb92 100644 --- a/kernel/time/Kconfig +++ b/kernel/time/Kconfig | |||
@@ -104,11 +104,13 @@ config NO_HZ_FULL | |||
104 | depends on SMP | 104 | depends on SMP |
105 | # RCU_USER_QS dependency | 105 | # RCU_USER_QS dependency |
106 | depends on HAVE_CONTEXT_TRACKING | 106 | depends on HAVE_CONTEXT_TRACKING |
107 | depends on VIRT_CPU_ACCOUNTING_GEN | 107 | # VIRT_CPU_ACCOUNTING_GEN dependency |
108 | depends on 64BIT | ||
108 | select NO_HZ_COMMON | 109 | select NO_HZ_COMMON |
109 | select RCU_USER_QS | 110 | select RCU_USER_QS |
110 | select RCU_NOCB_CPU | 111 | select RCU_NOCB_CPU |
111 | select RCU_NOCB_CPU_ALL | 112 | select RCU_NOCB_CPU_ALL |
113 | select VIRT_CPU_ACCOUNTING_GEN | ||
112 | select CONTEXT_TRACKING_FORCE | 114 | select CONTEXT_TRACKING_FORCE |
113 | select IRQ_WORK | 115 | select IRQ_WORK |
114 | help | 116 | help |