diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/ia64/include/asm/cputime.h | 72 | ||||
-rw-r--r-- | arch/powerpc/include/asm/cputime.h | 70 | ||||
-rw-r--r-- | arch/s390/appldata/appldata_os.c | 16 | ||||
-rw-r--r-- | arch/s390/include/asm/cputime.h | 140 | ||||
-rw-r--r-- | arch/x86/include/asm/i387.h | 2 |
5 files changed, 133 insertions, 167 deletions
diff --git a/arch/ia64/include/asm/cputime.h b/arch/ia64/include/asm/cputime.h index 5a274af31b2b..3deac956d325 100644 --- a/arch/ia64/include/asm/cputime.h +++ b/arch/ia64/include/asm/cputime.h | |||
@@ -26,60 +26,53 @@ | |||
26 | #include <linux/jiffies.h> | 26 | #include <linux/jiffies.h> |
27 | #include <asm/processor.h> | 27 | #include <asm/processor.h> |
28 | 28 | ||
29 | typedef u64 cputime_t; | 29 | typedef u64 __nocast cputime_t; |
30 | typedef u64 cputime64_t; | 30 | typedef u64 __nocast cputime64_t; |
31 | 31 | ||
32 | #define cputime_zero ((cputime_t)0) | ||
33 | #define cputime_one_jiffy jiffies_to_cputime(1) | 32 | #define cputime_one_jiffy jiffies_to_cputime(1) |
34 | #define cputime_max ((~((cputime_t)0) >> 1) - 1) | ||
35 | #define cputime_add(__a, __b) ((__a) + (__b)) | ||
36 | #define cputime_sub(__a, __b) ((__a) - (__b)) | ||
37 | #define cputime_div(__a, __n) ((__a) / (__n)) | ||
38 | #define cputime_halve(__a) ((__a) >> 1) | ||
39 | #define cputime_eq(__a, __b) ((__a) == (__b)) | ||
40 | #define cputime_gt(__a, __b) ((__a) > (__b)) | ||
41 | #define cputime_ge(__a, __b) ((__a) >= (__b)) | ||
42 | #define cputime_lt(__a, __b) ((__a) < (__b)) | ||
43 | #define cputime_le(__a, __b) ((__a) <= (__b)) | ||
44 | |||
45 | #define cputime64_zero ((cputime64_t)0) | ||
46 | #define cputime64_add(__a, __b) ((__a) + (__b)) | ||
47 | #define cputime64_sub(__a, __b) ((__a) - (__b)) | ||
48 | #define cputime_to_cputime64(__ct) (__ct) | ||
49 | 33 | ||
50 | /* | 34 | /* |
51 | * Convert cputime <-> jiffies (HZ) | 35 | * Convert cputime <-> jiffies (HZ) |
52 | */ | 36 | */ |
53 | #define cputime_to_jiffies(__ct) ((__ct) / (NSEC_PER_SEC / HZ)) | 37 | #define cputime_to_jiffies(__ct) \ |
54 | #define jiffies_to_cputime(__jif) ((__jif) * (NSEC_PER_SEC / HZ)) | 38 | ((__force u64)(__ct) / (NSEC_PER_SEC / HZ)) |
55 | #define cputime64_to_jiffies64(__ct) ((__ct) / (NSEC_PER_SEC / HZ)) | 39 | #define jiffies_to_cputime(__jif) \ |
56 | #define jiffies64_to_cputime64(__jif) ((__jif) * (NSEC_PER_SEC / HZ)) | 40 | (__force cputime_t)((__jif) * (NSEC_PER_SEC / HZ)) |
41 | #define cputime64_to_jiffies64(__ct) \ | ||
42 | ((__force u64)(__ct) / (NSEC_PER_SEC / HZ)) | ||
43 | #define jiffies64_to_cputime64(__jif) \ | ||
44 | (__force cputime64_t)((__jif) * (NSEC_PER_SEC / HZ)) | ||
57 | 45 | ||
58 | /* | 46 | /* |
59 | * Convert cputime <-> microseconds | 47 | * Convert cputime <-> microseconds |
60 | */ | 48 | */ |
61 | #define cputime_to_usecs(__ct) ((__ct) / NSEC_PER_USEC) | 49 | #define cputime_to_usecs(__ct) \ |
62 | #define usecs_to_cputime(__usecs) ((__usecs) * NSEC_PER_USEC) | 50 | ((__force u64)(__ct) / NSEC_PER_USEC) |
63 | #define usecs_to_cputime64(__usecs) usecs_to_cputime(__usecs) | 51 | #define usecs_to_cputime(__usecs) \ |
52 | (__force cputime_t)((__usecs) * NSEC_PER_USEC) | ||
53 | #define usecs_to_cputime64(__usecs) \ | ||
54 | (__force cputime64_t)((__usecs) * NSEC_PER_USEC) | ||
64 | 55 | ||
65 | /* | 56 | /* |
66 | * Convert cputime <-> seconds | 57 | * Convert cputime <-> seconds |
67 | */ | 58 | */ |
68 | #define cputime_to_secs(__ct) ((__ct) / NSEC_PER_SEC) | 59 | #define cputime_to_secs(__ct) \ |
69 | #define secs_to_cputime(__secs) ((__secs) * NSEC_PER_SEC) | 60 | ((__force u64)(__ct) / NSEC_PER_SEC) |
61 | #define secs_to_cputime(__secs) \ | ||
62 | (__force cputime_t)((__secs) * NSEC_PER_SEC) | ||
70 | 63 | ||
71 | /* | 64 | /* |
72 | * Convert cputime <-> timespec (nsec) | 65 | * Convert cputime <-> timespec (nsec) |
73 | */ | 66 | */ |
74 | static inline cputime_t timespec_to_cputime(const struct timespec *val) | 67 | static inline cputime_t timespec_to_cputime(const struct timespec *val) |
75 | { | 68 | { |
76 | cputime_t ret = val->tv_sec * NSEC_PER_SEC; | 69 | u64 ret = val->tv_sec * NSEC_PER_SEC + val->tv_nsec; |
77 | return (ret + val->tv_nsec); | 70 | return (__force cputime_t) ret; |
78 | } | 71 | } |
79 | static inline void cputime_to_timespec(const cputime_t ct, struct timespec *val) | 72 | static inline void cputime_to_timespec(const cputime_t ct, struct timespec *val) |
80 | { | 73 | { |
81 | val->tv_sec = ct / NSEC_PER_SEC; | 74 | val->tv_sec = (__force u64) ct / NSEC_PER_SEC; |
82 | val->tv_nsec = ct % NSEC_PER_SEC; | 75 | val->tv_nsec = (__force u64) ct % NSEC_PER_SEC; |
83 | } | 76 | } |
84 | 77 | ||
85 | /* | 78 | /* |
@@ -87,25 +80,28 @@ static inline void cputime_to_timespec(const cputime_t ct, struct timespec *val) | |||
87 | */ | 80 | */ |
88 | static inline cputime_t timeval_to_cputime(struct timeval *val) | 81 | static inline cputime_t timeval_to_cputime(struct timeval *val) |
89 | { | 82 | { |
90 | cputime_t ret = val->tv_sec * NSEC_PER_SEC; | 83 | u64 ret = val->tv_sec * NSEC_PER_SEC + val->tv_usec * NSEC_PER_USEC; |
91 | return (ret + val->tv_usec * NSEC_PER_USEC); | 84 | return (__force cputime_t) ret; |
92 | } | 85 | } |
93 | static inline void cputime_to_timeval(const cputime_t ct, struct timeval *val) | 86 | static inline void cputime_to_timeval(const cputime_t ct, struct timeval *val) |
94 | { | 87 | { |
95 | val->tv_sec = ct / NSEC_PER_SEC; | 88 | val->tv_sec = (__force u64) ct / NSEC_PER_SEC; |
96 | val->tv_usec = (ct % NSEC_PER_SEC) / NSEC_PER_USEC; | 89 | val->tv_usec = ((__force u64) ct % NSEC_PER_SEC) / NSEC_PER_USEC; |
97 | } | 90 | } |
98 | 91 | ||
99 | /* | 92 | /* |
100 | * Convert cputime <-> clock (USER_HZ) | 93 | * Convert cputime <-> clock (USER_HZ) |
101 | */ | 94 | */ |
102 | #define cputime_to_clock_t(__ct) ((__ct) / (NSEC_PER_SEC / USER_HZ)) | 95 | #define cputime_to_clock_t(__ct) \ |
103 | #define clock_t_to_cputime(__x) ((__x) * (NSEC_PER_SEC / USER_HZ)) | 96 | ((__force u64)(__ct) / (NSEC_PER_SEC / USER_HZ)) |
97 | #define clock_t_to_cputime(__x) \ | ||
98 | (__force cputime_t)((__x) * (NSEC_PER_SEC / USER_HZ)) | ||
104 | 99 | ||
105 | /* | 100 | /* |
106 | * Convert cputime64 to clock. | 101 | * Convert cputime64 to clock. |
107 | */ | 102 | */ |
108 | #define cputime64_to_clock_t(__ct) cputime_to_clock_t((cputime_t)__ct) | 103 | #define cputime64_to_clock_t(__ct) \ |
104 | cputime_to_clock_t((__force cputime_t)__ct) | ||
109 | 105 | ||
110 | #endif /* CONFIG_VIRT_CPU_ACCOUNTING */ | 106 | #endif /* CONFIG_VIRT_CPU_ACCOUNTING */ |
111 | #endif /* __IA64_CPUTIME_H */ | 107 | #endif /* __IA64_CPUTIME_H */ |
diff --git a/arch/powerpc/include/asm/cputime.h b/arch/powerpc/include/asm/cputime.h index 98b7c4b49c9d..6ec1c380a4d6 100644 --- a/arch/powerpc/include/asm/cputime.h +++ b/arch/powerpc/include/asm/cputime.h | |||
@@ -29,25 +29,8 @@ static inline void setup_cputime_one_jiffy(void) { } | |||
29 | #include <asm/time.h> | 29 | #include <asm/time.h> |
30 | #include <asm/param.h> | 30 | #include <asm/param.h> |
31 | 31 | ||
32 | typedef u64 cputime_t; | 32 | typedef u64 __nocast cputime_t; |
33 | typedef u64 cputime64_t; | 33 | typedef u64 __nocast cputime64_t; |
34 | |||
35 | #define cputime_zero ((cputime_t)0) | ||
36 | #define cputime_max ((~((cputime_t)0) >> 1) - 1) | ||
37 | #define cputime_add(__a, __b) ((__a) + (__b)) | ||
38 | #define cputime_sub(__a, __b) ((__a) - (__b)) | ||
39 | #define cputime_div(__a, __n) ((__a) / (__n)) | ||
40 | #define cputime_halve(__a) ((__a) >> 1) | ||
41 | #define cputime_eq(__a, __b) ((__a) == (__b)) | ||
42 | #define cputime_gt(__a, __b) ((__a) > (__b)) | ||
43 | #define cputime_ge(__a, __b) ((__a) >= (__b)) | ||
44 | #define cputime_lt(__a, __b) ((__a) < (__b)) | ||
45 | #define cputime_le(__a, __b) ((__a) <= (__b)) | ||
46 | |||
47 | #define cputime64_zero ((cputime64_t)0) | ||
48 | #define cputime64_add(__a, __b) ((__a) + (__b)) | ||
49 | #define cputime64_sub(__a, __b) ((__a) - (__b)) | ||
50 | #define cputime_to_cputime64(__ct) (__ct) | ||
51 | 34 | ||
52 | #ifdef __KERNEL__ | 35 | #ifdef __KERNEL__ |
53 | 36 | ||
@@ -65,7 +48,7 @@ DECLARE_PER_CPU(unsigned long, cputime_scaled_last_delta); | |||
65 | 48 | ||
66 | static inline unsigned long cputime_to_jiffies(const cputime_t ct) | 49 | static inline unsigned long cputime_to_jiffies(const cputime_t ct) |
67 | { | 50 | { |
68 | return mulhdu(ct, __cputime_jiffies_factor); | 51 | return mulhdu((__force u64) ct, __cputime_jiffies_factor); |
69 | } | 52 | } |
70 | 53 | ||
71 | /* Estimate the scaled cputime by scaling the real cputime based on | 54 | /* Estimate the scaled cputime by scaling the real cputime based on |
@@ -74,14 +57,15 @@ static inline cputime_t cputime_to_scaled(const cputime_t ct) | |||
74 | { | 57 | { |
75 | if (cpu_has_feature(CPU_FTR_SPURR) && | 58 | if (cpu_has_feature(CPU_FTR_SPURR) && |
76 | __get_cpu_var(cputime_last_delta)) | 59 | __get_cpu_var(cputime_last_delta)) |
77 | return ct * __get_cpu_var(cputime_scaled_last_delta) / | 60 | return (__force u64) ct * |
78 | __get_cpu_var(cputime_last_delta); | 61 | __get_cpu_var(cputime_scaled_last_delta) / |
62 | __get_cpu_var(cputime_last_delta); | ||
79 | return ct; | 63 | return ct; |
80 | } | 64 | } |
81 | 65 | ||
82 | static inline cputime_t jiffies_to_cputime(const unsigned long jif) | 66 | static inline cputime_t jiffies_to_cputime(const unsigned long jif) |
83 | { | 67 | { |
84 | cputime_t ct; | 68 | u64 ct; |
85 | unsigned long sec; | 69 | unsigned long sec; |
86 | 70 | ||
87 | /* have to be a little careful about overflow */ | 71 | /* have to be a little careful about overflow */ |
@@ -93,7 +77,7 @@ static inline cputime_t jiffies_to_cputime(const unsigned long jif) | |||
93 | } | 77 | } |
94 | if (sec) | 78 | if (sec) |
95 | ct += (cputime_t) sec * tb_ticks_per_sec; | 79 | ct += (cputime_t) sec * tb_ticks_per_sec; |
96 | return ct; | 80 | return (__force cputime_t) ct; |
97 | } | 81 | } |
98 | 82 | ||
99 | static inline void setup_cputime_one_jiffy(void) | 83 | static inline void setup_cputime_one_jiffy(void) |
@@ -103,7 +87,7 @@ static inline void setup_cputime_one_jiffy(void) | |||
103 | 87 | ||
104 | static inline cputime64_t jiffies64_to_cputime64(const u64 jif) | 88 | static inline cputime64_t jiffies64_to_cputime64(const u64 jif) |
105 | { | 89 | { |
106 | cputime_t ct; | 90 | u64 ct; |
107 | u64 sec; | 91 | u64 sec; |
108 | 92 | ||
109 | /* have to be a little careful about overflow */ | 93 | /* have to be a little careful about overflow */ |
@@ -114,13 +98,13 @@ static inline cputime64_t jiffies64_to_cputime64(const u64 jif) | |||
114 | do_div(ct, HZ); | 98 | do_div(ct, HZ); |
115 | } | 99 | } |
116 | if (sec) | 100 | if (sec) |
117 | ct += (cputime_t) sec * tb_ticks_per_sec; | 101 | ct += (u64) sec * tb_ticks_per_sec; |
118 | return ct; | 102 | return (__force cputime64_t) ct; |
119 | } | 103 | } |
120 | 104 | ||
121 | static inline u64 cputime64_to_jiffies64(const cputime_t ct) | 105 | static inline u64 cputime64_to_jiffies64(const cputime_t ct) |
122 | { | 106 | { |
123 | return mulhdu(ct, __cputime_jiffies_factor); | 107 | return mulhdu((__force u64) ct, __cputime_jiffies_factor); |
124 | } | 108 | } |
125 | 109 | ||
126 | /* | 110 | /* |
@@ -130,12 +114,12 @@ extern u64 __cputime_msec_factor; | |||
130 | 114 | ||
131 | static inline unsigned long cputime_to_usecs(const cputime_t ct) | 115 | static inline unsigned long cputime_to_usecs(const cputime_t ct) |
132 | { | 116 | { |
133 | return mulhdu(ct, __cputime_msec_factor) * USEC_PER_MSEC; | 117 | return mulhdu((__force u64) ct, __cputime_msec_factor) * USEC_PER_MSEC; |
134 | } | 118 | } |
135 | 119 | ||
136 | static inline cputime_t usecs_to_cputime(const unsigned long us) | 120 | static inline cputime_t usecs_to_cputime(const unsigned long us) |
137 | { | 121 | { |
138 | cputime_t ct; | 122 | u64 ct; |
139 | unsigned long sec; | 123 | unsigned long sec; |
140 | 124 | ||
141 | /* have to be a little careful about overflow */ | 125 | /* have to be a little careful about overflow */ |
@@ -147,7 +131,7 @@ static inline cputime_t usecs_to_cputime(const unsigned long us) | |||
147 | } | 131 | } |
148 | if (sec) | 132 | if (sec) |
149 | ct += (cputime_t) sec * tb_ticks_per_sec; | 133 | ct += (cputime_t) sec * tb_ticks_per_sec; |
150 | return ct; | 134 | return (__force cputime_t) ct; |
151 | } | 135 | } |
152 | 136 | ||
153 | #define usecs_to_cputime64(us) usecs_to_cputime(us) | 137 | #define usecs_to_cputime64(us) usecs_to_cputime(us) |
@@ -159,12 +143,12 @@ extern u64 __cputime_sec_factor; | |||
159 | 143 | ||
160 | static inline unsigned long cputime_to_secs(const cputime_t ct) | 144 | static inline unsigned long cputime_to_secs(const cputime_t ct) |
161 | { | 145 | { |
162 | return mulhdu(ct, __cputime_sec_factor); | 146 | return mulhdu((__force u64) ct, __cputime_sec_factor); |
163 | } | 147 | } |
164 | 148 | ||
165 | static inline cputime_t secs_to_cputime(const unsigned long sec) | 149 | static inline cputime_t secs_to_cputime(const unsigned long sec) |
166 | { | 150 | { |
167 | return (cputime_t) sec * tb_ticks_per_sec; | 151 | return (__force cputime_t)((u64) sec * tb_ticks_per_sec); |
168 | } | 152 | } |
169 | 153 | ||
170 | /* | 154 | /* |
@@ -172,7 +156,7 @@ static inline cputime_t secs_to_cputime(const unsigned long sec) | |||
172 | */ | 156 | */ |
173 | static inline void cputime_to_timespec(const cputime_t ct, struct timespec *p) | 157 | static inline void cputime_to_timespec(const cputime_t ct, struct timespec *p) |
174 | { | 158 | { |
175 | u64 x = ct; | 159 | u64 x = (__force u64) ct; |
176 | unsigned int frac; | 160 | unsigned int frac; |
177 | 161 | ||
178 | frac = do_div(x, tb_ticks_per_sec); | 162 | frac = do_div(x, tb_ticks_per_sec); |
@@ -184,11 +168,11 @@ static inline void cputime_to_timespec(const cputime_t ct, struct timespec *p) | |||
184 | 168 | ||
185 | static inline cputime_t timespec_to_cputime(const struct timespec *p) | 169 | static inline cputime_t timespec_to_cputime(const struct timespec *p) |
186 | { | 170 | { |
187 | cputime_t ct; | 171 | u64 ct; |
188 | 172 | ||
189 | ct = (u64) p->tv_nsec * tb_ticks_per_sec; | 173 | ct = (u64) p->tv_nsec * tb_ticks_per_sec; |
190 | do_div(ct, 1000000000); | 174 | do_div(ct, 1000000000); |
191 | return ct + (u64) p->tv_sec * tb_ticks_per_sec; | 175 | return (__force cputime_t)(ct + (u64) p->tv_sec * tb_ticks_per_sec); |
192 | } | 176 | } |
193 | 177 | ||
194 | /* | 178 | /* |
@@ -196,7 +180,7 @@ static inline cputime_t timespec_to_cputime(const struct timespec *p) | |||
196 | */ | 180 | */ |
197 | static inline void cputime_to_timeval(const cputime_t ct, struct timeval *p) | 181 | static inline void cputime_to_timeval(const cputime_t ct, struct timeval *p) |
198 | { | 182 | { |
199 | u64 x = ct; | 183 | u64 x = (__force u64) ct; |
200 | unsigned int frac; | 184 | unsigned int frac; |
201 | 185 | ||
202 | frac = do_div(x, tb_ticks_per_sec); | 186 | frac = do_div(x, tb_ticks_per_sec); |
@@ -208,11 +192,11 @@ static inline void cputime_to_timeval(const cputime_t ct, struct timeval *p) | |||
208 | 192 | ||
209 | static inline cputime_t timeval_to_cputime(const struct timeval *p) | 193 | static inline cputime_t timeval_to_cputime(const struct timeval *p) |
210 | { | 194 | { |
211 | cputime_t ct; | 195 | u64 ct; |
212 | 196 | ||
213 | ct = (u64) p->tv_usec * tb_ticks_per_sec; | 197 | ct = (u64) p->tv_usec * tb_ticks_per_sec; |
214 | do_div(ct, 1000000); | 198 | do_div(ct, 1000000); |
215 | return ct + (u64) p->tv_sec * tb_ticks_per_sec; | 199 | return (__force cputime_t)(ct + (u64) p->tv_sec * tb_ticks_per_sec); |
216 | } | 200 | } |
217 | 201 | ||
218 | /* | 202 | /* |
@@ -222,12 +206,12 @@ extern u64 __cputime_clockt_factor; | |||
222 | 206 | ||
223 | static inline unsigned long cputime_to_clock_t(const cputime_t ct) | 207 | static inline unsigned long cputime_to_clock_t(const cputime_t ct) |
224 | { | 208 | { |
225 | return mulhdu(ct, __cputime_clockt_factor); | 209 | return mulhdu((__force u64) ct, __cputime_clockt_factor); |
226 | } | 210 | } |
227 | 211 | ||
228 | static inline cputime_t clock_t_to_cputime(const unsigned long clk) | 212 | static inline cputime_t clock_t_to_cputime(const unsigned long clk) |
229 | { | 213 | { |
230 | cputime_t ct; | 214 | u64 ct; |
231 | unsigned long sec; | 215 | unsigned long sec; |
232 | 216 | ||
233 | /* have to be a little careful about overflow */ | 217 | /* have to be a little careful about overflow */ |
@@ -238,8 +222,8 @@ static inline cputime_t clock_t_to_cputime(const unsigned long clk) | |||
238 | do_div(ct, USER_HZ); | 222 | do_div(ct, USER_HZ); |
239 | } | 223 | } |
240 | if (sec) | 224 | if (sec) |
241 | ct += (cputime_t) sec * tb_ticks_per_sec; | 225 | ct += (u64) sec * tb_ticks_per_sec; |
242 | return ct; | 226 | return (__force cputime_t) ct; |
243 | } | 227 | } |
244 | 228 | ||
245 | #define cputime64_to_clock_t(ct) cputime_to_clock_t((cputime_t)(ct)) | 229 | #define cputime64_to_clock_t(ct) cputime_to_clock_t((cputime_t)(ct)) |
diff --git a/arch/s390/appldata/appldata_os.c b/arch/s390/appldata/appldata_os.c index 92f1cb745d69..4de031d6b76c 100644 --- a/arch/s390/appldata/appldata_os.c +++ b/arch/s390/appldata/appldata_os.c | |||
@@ -115,21 +115,21 @@ static void appldata_get_os_data(void *data) | |||
115 | j = 0; | 115 | j = 0; |
116 | for_each_online_cpu(i) { | 116 | for_each_online_cpu(i) { |
117 | os_data->os_cpu[j].per_cpu_user = | 117 | os_data->os_cpu[j].per_cpu_user = |
118 | cputime_to_jiffies(kstat_cpu(i).cpustat.user); | 118 | cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_USER]); |
119 | os_data->os_cpu[j].per_cpu_nice = | 119 | os_data->os_cpu[j].per_cpu_nice = |
120 | cputime_to_jiffies(kstat_cpu(i).cpustat.nice); | 120 | cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_NICE]); |
121 | os_data->os_cpu[j].per_cpu_system = | 121 | os_data->os_cpu[j].per_cpu_system = |
122 | cputime_to_jiffies(kstat_cpu(i).cpustat.system); | 122 | cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_SYSTEM]); |
123 | os_data->os_cpu[j].per_cpu_idle = | 123 | os_data->os_cpu[j].per_cpu_idle = |
124 | cputime_to_jiffies(kstat_cpu(i).cpustat.idle); | 124 | cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_IDLE]); |
125 | os_data->os_cpu[j].per_cpu_irq = | 125 | os_data->os_cpu[j].per_cpu_irq = |
126 | cputime_to_jiffies(kstat_cpu(i).cpustat.irq); | 126 | cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_IRQ]); |
127 | os_data->os_cpu[j].per_cpu_softirq = | 127 | os_data->os_cpu[j].per_cpu_softirq = |
128 | cputime_to_jiffies(kstat_cpu(i).cpustat.softirq); | 128 | cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_SOFTIRQ]); |
129 | os_data->os_cpu[j].per_cpu_iowait = | 129 | os_data->os_cpu[j].per_cpu_iowait = |
130 | cputime_to_jiffies(kstat_cpu(i).cpustat.iowait); | 130 | cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_IOWAIT]); |
131 | os_data->os_cpu[j].per_cpu_steal = | 131 | os_data->os_cpu[j].per_cpu_steal = |
132 | cputime_to_jiffies(kstat_cpu(i).cpustat.steal); | 132 | cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_STEAL]); |
133 | os_data->os_cpu[j].cpu_id = i; | 133 | os_data->os_cpu[j].cpu_id = i; |
134 | j++; | 134 | j++; |
135 | } | 135 | } |
diff --git a/arch/s390/include/asm/cputime.h b/arch/s390/include/asm/cputime.h index b9acaaa175d8..c23c3900c304 100644 --- a/arch/s390/include/asm/cputime.h +++ b/arch/s390/include/asm/cputime.h | |||
@@ -16,75 +16,60 @@ | |||
16 | 16 | ||
17 | /* We want to use full resolution of the CPU timer: 2**-12 micro-seconds. */ | 17 | /* We want to use full resolution of the CPU timer: 2**-12 micro-seconds. */ |
18 | 18 | ||
19 | typedef unsigned long long cputime_t; | 19 | typedef unsigned long long __nocast cputime_t; |
20 | typedef unsigned long long cputime64_t; | 20 | typedef unsigned long long __nocast cputime64_t; |
21 | 21 | ||
22 | #ifndef __s390x__ | 22 | static inline unsigned long __div(unsigned long long n, unsigned long base) |
23 | |||
24 | static inline unsigned int | ||
25 | __div(unsigned long long n, unsigned int base) | ||
26 | { | 23 | { |
24 | #ifndef __s390x__ | ||
27 | register_pair rp; | 25 | register_pair rp; |
28 | 26 | ||
29 | rp.pair = n >> 1; | 27 | rp.pair = n >> 1; |
30 | asm ("dr %0,%1" : "+d" (rp) : "d" (base >> 1)); | 28 | asm ("dr %0,%1" : "+d" (rp) : "d" (base >> 1)); |
31 | return rp.subreg.odd; | 29 | return rp.subreg.odd; |
30 | #else /* __s390x__ */ | ||
31 | return n / base; | ||
32 | #endif /* __s390x__ */ | ||
32 | } | 33 | } |
33 | 34 | ||
34 | #else /* __s390x__ */ | 35 | #define cputime_one_jiffy jiffies_to_cputime(1) |
35 | 36 | ||
36 | static inline unsigned int | 37 | /* |
37 | __div(unsigned long long n, unsigned int base) | 38 | * Convert cputime to jiffies and back. |
39 | */ | ||
40 | static inline unsigned long cputime_to_jiffies(const cputime_t cputime) | ||
38 | { | 41 | { |
39 | return n / base; | 42 | return __div((__force unsigned long long) cputime, 4096000000ULL / HZ); |
40 | } | 43 | } |
41 | 44 | ||
42 | #endif /* __s390x__ */ | 45 | static inline cputime_t jiffies_to_cputime(const unsigned int jif) |
46 | { | ||
47 | return (__force cputime_t)(jif * (4096000000ULL / HZ)); | ||
48 | } | ||
43 | 49 | ||
44 | #define cputime_zero (0ULL) | 50 | static inline u64 cputime64_to_jiffies64(cputime64_t cputime) |
45 | #define cputime_one_jiffy jiffies_to_cputime(1) | 51 | { |
46 | #define cputime_max ((~0UL >> 1) - 1) | 52 | unsigned long long jif = (__force unsigned long long) cputime; |
47 | #define cputime_add(__a, __b) ((__a) + (__b)) | 53 | do_div(jif, 4096000000ULL / HZ); |
48 | #define cputime_sub(__a, __b) ((__a) - (__b)) | 54 | return jif; |
49 | #define cputime_div(__a, __n) ({ \ | 55 | } |
50 | unsigned long long __div = (__a); \ | 56 | |
51 | do_div(__div,__n); \ | 57 | static inline cputime64_t jiffies64_to_cputime64(const u64 jif) |
52 | __div; \ | 58 | { |
53 | }) | 59 | return (__force cputime64_t)(jif * (4096000000ULL / HZ)); |
54 | #define cputime_halve(__a) ((__a) >> 1) | ||
55 | #define cputime_eq(__a, __b) ((__a) == (__b)) | ||
56 | #define cputime_gt(__a, __b) ((__a) > (__b)) | ||
57 | #define cputime_ge(__a, __b) ((__a) >= (__b)) | ||
58 | #define cputime_lt(__a, __b) ((__a) < (__b)) | ||
59 | #define cputime_le(__a, __b) ((__a) <= (__b)) | ||
60 | #define cputime_to_jiffies(__ct) (__div((__ct), 4096000000ULL / HZ)) | ||
61 | #define cputime_to_scaled(__ct) (__ct) | ||
62 | #define jiffies_to_cputime(__hz) ((cputime_t)(__hz) * (4096000000ULL / HZ)) | ||
63 | |||
64 | #define cputime64_zero (0ULL) | ||
65 | #define cputime64_add(__a, __b) ((__a) + (__b)) | ||
66 | #define cputime_to_cputime64(__ct) (__ct) | ||
67 | |||
68 | static inline u64 | ||
69 | cputime64_to_jiffies64(cputime64_t cputime) | ||
70 | { | ||
71 | do_div(cputime, 4096000000ULL / HZ); | ||
72 | return cputime; | ||
73 | } | 60 | } |
74 | 61 | ||
75 | /* | 62 | /* |
76 | * Convert cputime to microseconds and back. | 63 | * Convert cputime to microseconds and back. |
77 | */ | 64 | */ |
78 | static inline unsigned int | 65 | static inline unsigned int cputime_to_usecs(const cputime_t cputime) |
79 | cputime_to_usecs(const cputime_t cputime) | ||
80 | { | 66 | { |
81 | return cputime_div(cputime, 4096); | 67 | return (__force unsigned long long) cputime >> 12; |
82 | } | 68 | } |
83 | 69 | ||
84 | static inline cputime_t | 70 | static inline cputime_t usecs_to_cputime(const unsigned int m) |
85 | usecs_to_cputime(const unsigned int m) | ||
86 | { | 71 | { |
87 | return (cputime_t) m * 4096; | 72 | return (__force cputime_t)(m * 4096ULL); |
88 | } | 73 | } |
89 | 74 | ||
90 | #define usecs_to_cputime64(m) usecs_to_cputime(m) | 75 | #define usecs_to_cputime64(m) usecs_to_cputime(m) |
@@ -92,40 +77,39 @@ usecs_to_cputime(const unsigned int m) | |||
92 | /* | 77 | /* |
93 | * Convert cputime to milliseconds and back. | 78 | * Convert cputime to milliseconds and back. |
94 | */ | 79 | */ |
95 | static inline unsigned int | 80 | static inline unsigned int cputime_to_secs(const cputime_t cputime) |
96 | cputime_to_secs(const cputime_t cputime) | ||
97 | { | 81 | { |
98 | return __div(cputime, 2048000000) >> 1; | 82 | return __div((__force unsigned long long) cputime, 2048000000) >> 1; |
99 | } | 83 | } |
100 | 84 | ||
101 | static inline cputime_t | 85 | static inline cputime_t secs_to_cputime(const unsigned int s) |
102 | secs_to_cputime(const unsigned int s) | ||
103 | { | 86 | { |
104 | return (cputime_t) s * 4096000000ULL; | 87 | return (__force cputime_t)(s * 4096000000ULL); |
105 | } | 88 | } |
106 | 89 | ||
107 | /* | 90 | /* |
108 | * Convert cputime to timespec and back. | 91 | * Convert cputime to timespec and back. |
109 | */ | 92 | */ |
110 | static inline cputime_t | 93 | static inline cputime_t timespec_to_cputime(const struct timespec *value) |
111 | timespec_to_cputime(const struct timespec *value) | ||
112 | { | 94 | { |
113 | return value->tv_nsec * 4096 / 1000 + (u64) value->tv_sec * 4096000000ULL; | 95 | unsigned long long ret = value->tv_sec * 4096000000ULL; |
96 | return (__force cputime_t)(ret + value->tv_nsec * 4096 / 1000); | ||
114 | } | 97 | } |
115 | 98 | ||
116 | static inline void | 99 | static inline void cputime_to_timespec(const cputime_t cputime, |
117 | cputime_to_timespec(const cputime_t cputime, struct timespec *value) | 100 | struct timespec *value) |
118 | { | 101 | { |
102 | unsigned long long __cputime = (__force unsigned long long) cputime; | ||
119 | #ifndef __s390x__ | 103 | #ifndef __s390x__ |
120 | register_pair rp; | 104 | register_pair rp; |
121 | 105 | ||
122 | rp.pair = cputime >> 1; | 106 | rp.pair = __cputime >> 1; |
123 | asm ("dr %0,%1" : "+d" (rp) : "d" (2048000000UL)); | 107 | asm ("dr %0,%1" : "+d" (rp) : "d" (2048000000UL)); |
124 | value->tv_nsec = rp.subreg.even * 1000 / 4096; | 108 | value->tv_nsec = rp.subreg.even * 1000 / 4096; |
125 | value->tv_sec = rp.subreg.odd; | 109 | value->tv_sec = rp.subreg.odd; |
126 | #else | 110 | #else |
127 | value->tv_nsec = (cputime % 4096000000ULL) * 1000 / 4096; | 111 | value->tv_nsec = (__cputime % 4096000000ULL) * 1000 / 4096; |
128 | value->tv_sec = cputime / 4096000000ULL; | 112 | value->tv_sec = __cputime / 4096000000ULL; |
129 | #endif | 113 | #endif |
130 | } | 114 | } |
131 | 115 | ||
@@ -134,50 +118,52 @@ cputime_to_timespec(const cputime_t cputime, struct timespec *value) | |||
134 | * Since cputime and timeval have the same resolution (microseconds) | 118 | * Since cputime and timeval have the same resolution (microseconds) |
135 | * this is easy. | 119 | * this is easy. |
136 | */ | 120 | */ |
137 | static inline cputime_t | 121 | static inline cputime_t timeval_to_cputime(const struct timeval *value) |
138 | timeval_to_cputime(const struct timeval *value) | ||
139 | { | 122 | { |
140 | return value->tv_usec * 4096 + (u64) value->tv_sec * 4096000000ULL; | 123 | unsigned long long ret = value->tv_sec * 4096000000ULL; |
124 | return (__force cputime_t)(ret + value->tv_usec * 4096ULL); | ||
141 | } | 125 | } |
142 | 126 | ||
143 | static inline void | 127 | static inline void cputime_to_timeval(const cputime_t cputime, |
144 | cputime_to_timeval(const cputime_t cputime, struct timeval *value) | 128 | struct timeval *value) |
145 | { | 129 | { |
130 | unsigned long long __cputime = (__force unsigned long long) cputime; | ||
146 | #ifndef __s390x__ | 131 | #ifndef __s390x__ |
147 | register_pair rp; | 132 | register_pair rp; |
148 | 133 | ||
149 | rp.pair = cputime >> 1; | 134 | rp.pair = __cputime >> 1; |
150 | asm ("dr %0,%1" : "+d" (rp) : "d" (2048000000UL)); | 135 | asm ("dr %0,%1" : "+d" (rp) : "d" (2048000000UL)); |
151 | value->tv_usec = rp.subreg.even / 4096; | 136 | value->tv_usec = rp.subreg.even / 4096; |
152 | value->tv_sec = rp.subreg.odd; | 137 | value->tv_sec = rp.subreg.odd; |
153 | #else | 138 | #else |
154 | value->tv_usec = (cputime % 4096000000ULL) / 4096; | 139 | value->tv_usec = (__cputime % 4096000000ULL) / 4096; |
155 | value->tv_sec = cputime / 4096000000ULL; | 140 | value->tv_sec = __cputime / 4096000000ULL; |
156 | #endif | 141 | #endif |
157 | } | 142 | } |
158 | 143 | ||
159 | /* | 144 | /* |
160 | * Convert cputime to clock and back. | 145 | * Convert cputime to clock and back. |
161 | */ | 146 | */ |
162 | static inline clock_t | 147 | static inline clock_t cputime_to_clock_t(cputime_t cputime) |
163 | cputime_to_clock_t(cputime_t cputime) | ||
164 | { | 148 | { |
165 | return cputime_div(cputime, 4096000000ULL / USER_HZ); | 149 | unsigned long long clock = (__force unsigned long long) cputime; |
150 | do_div(clock, 4096000000ULL / USER_HZ); | ||
151 | return clock; | ||
166 | } | 152 | } |
167 | 153 | ||
168 | static inline cputime_t | 154 | static inline cputime_t clock_t_to_cputime(unsigned long x) |
169 | clock_t_to_cputime(unsigned long x) | ||
170 | { | 155 | { |
171 | return (cputime_t) x * (4096000000ULL / USER_HZ); | 156 | return (__force cputime_t)(x * (4096000000ULL / USER_HZ)); |
172 | } | 157 | } |
173 | 158 | ||
174 | /* | 159 | /* |
175 | * Convert cputime64 to clock. | 160 | * Convert cputime64 to clock. |
176 | */ | 161 | */ |
177 | static inline clock_t | 162 | static inline clock_t cputime64_to_clock_t(cputime64_t cputime) |
178 | cputime64_to_clock_t(cputime64_t cputime) | ||
179 | { | 163 | { |
180 | return cputime_div(cputime, 4096000000ULL / USER_HZ); | 164 | unsigned long long clock = (__force unsigned long long) cputime; |
165 | do_div(clock, 4096000000ULL / USER_HZ); | ||
166 | return clock; | ||
181 | } | 167 | } |
182 | 168 | ||
183 | struct s390_idle_data { | 169 | struct s390_idle_data { |
diff --git a/arch/x86/include/asm/i387.h b/arch/x86/include/asm/i387.h index c9e09ea05644..6919e936345b 100644 --- a/arch/x86/include/asm/i387.h +++ b/arch/x86/include/asm/i387.h | |||
@@ -218,7 +218,7 @@ static inline void fpu_fxsave(struct fpu *fpu) | |||
218 | #ifdef CONFIG_SMP | 218 | #ifdef CONFIG_SMP |
219 | #define safe_address (__per_cpu_offset[0]) | 219 | #define safe_address (__per_cpu_offset[0]) |
220 | #else | 220 | #else |
221 | #define safe_address (kstat_cpu(0).cpustat.user) | 221 | #define safe_address (__get_cpu_var(kernel_cpustat).cpustat[CPUTIME_USER]) |
222 | #endif | 222 | #endif |
223 | 223 | ||
224 | /* | 224 | /* |