diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2017-01-30 22:09:19 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2017-02-01 03:13:47 -0500 |
commit | 7fb1327ee9b92fca27662f9b9d60c7c3376d6c69 (patch) | |
tree | 7a75b34cf7db3d04a6e70b7f78c0b886ab45074a | |
parent | ba03ce822db234f8acb559de4a317a5c1f95c029 (diff) |
sched/cputime: Convert kcpustat to nsecs
Kernel CPU stats are stored in cputime_t which is an architecture
defined type, and hence a bit opaque and requiring accessors and mutators
for any operation.
Converting them to nsecs simplifies the code and is one step toward
the removal of cputime_t in the core code.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rik van Riel <riel@redhat.com>
Cc: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: Wanpeng Li <wanpeng.li@hotmail.com>
Link: http://lkml.kernel.org/r/1485832191-26889-4-git-send-email-fweisbec@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | arch/s390/appldata/appldata_os.c | 16 | ||||
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 6 | ||||
-rw-r--r-- | drivers/cpufreq/cpufreq_governor.c | 2 | ||||
-rw-r--r-- | drivers/cpufreq/cpufreq_stats.c | 1 | ||||
-rw-r--r-- | drivers/macintosh/rack-meter.c | 2 | ||||
-rw-r--r-- | fs/proc/stat.c | 68 | ||||
-rw-r--r-- | fs/proc/uptime.c | 7 | ||||
-rw-r--r-- | kernel/sched/cpuacct.c | 2 | ||||
-rw-r--r-- | kernel/sched/cputime.c | 22 |
9 files changed, 61 insertions, 65 deletions
diff --git a/arch/s390/appldata/appldata_os.c b/arch/s390/appldata/appldata_os.c index 69b23b25ac34..08b9e942a262 100644 --- a/arch/s390/appldata/appldata_os.c +++ b/arch/s390/appldata/appldata_os.c | |||
@@ -113,21 +113,21 @@ static void appldata_get_os_data(void *data) | |||
113 | j = 0; | 113 | j = 0; |
114 | for_each_online_cpu(i) { | 114 | for_each_online_cpu(i) { |
115 | os_data->os_cpu[j].per_cpu_user = | 115 | os_data->os_cpu[j].per_cpu_user = |
116 | cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_USER]); | 116 | nsecs_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_USER]); |
117 | os_data->os_cpu[j].per_cpu_nice = | 117 | os_data->os_cpu[j].per_cpu_nice = |
118 | cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_NICE]); | 118 | nsecs_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_NICE]); |
119 | os_data->os_cpu[j].per_cpu_system = | 119 | os_data->os_cpu[j].per_cpu_system = |
120 | cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_SYSTEM]); | 120 | nsecs_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_SYSTEM]); |
121 | os_data->os_cpu[j].per_cpu_idle = | 121 | os_data->os_cpu[j].per_cpu_idle = |
122 | cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_IDLE]); | 122 | nsecs_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_IDLE]); |
123 | os_data->os_cpu[j].per_cpu_irq = | 123 | os_data->os_cpu[j].per_cpu_irq = |
124 | cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_IRQ]); | 124 | nsecs_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_IRQ]); |
125 | os_data->os_cpu[j].per_cpu_softirq = | 125 | os_data->os_cpu[j].per_cpu_softirq = |
126 | cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_SOFTIRQ]); | 126 | nsecs_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_SOFTIRQ]); |
127 | os_data->os_cpu[j].per_cpu_iowait = | 127 | os_data->os_cpu[j].per_cpu_iowait = |
128 | cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_IOWAIT]); | 128 | nsecs_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_IOWAIT]); |
129 | os_data->os_cpu[j].per_cpu_steal = | 129 | os_data->os_cpu[j].per_cpu_steal = |
130 | cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_STEAL]); | 130 | nsecs_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_STEAL]); |
131 | os_data->os_cpu[j].cpu_id = i; | 131 | os_data->os_cpu[j].cpu_id = i; |
132 | j++; | 132 | j++; |
133 | } | 133 | } |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index cc475eff90b3..3e9b319a2e79 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -132,7 +132,7 @@ static inline u64 get_cpu_idle_time_jiffy(unsigned int cpu, u64 *wall) | |||
132 | u64 cur_wall_time; | 132 | u64 cur_wall_time; |
133 | u64 busy_time; | 133 | u64 busy_time; |
134 | 134 | ||
135 | cur_wall_time = jiffies64_to_cputime64(get_jiffies_64()); | 135 | cur_wall_time = jiffies64_to_nsecs(get_jiffies_64()); |
136 | 136 | ||
137 | busy_time = kcpustat_cpu(cpu).cpustat[CPUTIME_USER]; | 137 | busy_time = kcpustat_cpu(cpu).cpustat[CPUTIME_USER]; |
138 | busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_SYSTEM]; | 138 | busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_SYSTEM]; |
@@ -143,9 +143,9 @@ static inline u64 get_cpu_idle_time_jiffy(unsigned int cpu, u64 *wall) | |||
143 | 143 | ||
144 | idle_time = cur_wall_time - busy_time; | 144 | idle_time = cur_wall_time - busy_time; |
145 | if (wall) | 145 | if (wall) |
146 | *wall = cputime_to_usecs(cur_wall_time); | 146 | *wall = div_u64(cur_wall_time, NSEC_PER_USEC); |
147 | 147 | ||
148 | return cputime_to_usecs(idle_time); | 148 | return div_u64(idle_time, NSEC_PER_USEC); |
149 | } | 149 | } |
150 | 150 | ||
151 | u64 get_cpu_idle_time(unsigned int cpu, u64 *wall, int io_busy) | 151 | u64 get_cpu_idle_time(unsigned int cpu, u64 *wall, int io_busy) |
diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c index 0196467280bd..631bd2c86c5e 100644 --- a/drivers/cpufreq/cpufreq_governor.c +++ b/drivers/cpufreq/cpufreq_governor.c | |||
@@ -152,7 +152,7 @@ unsigned int dbs_update(struct cpufreq_policy *policy) | |||
152 | if (ignore_nice) { | 152 | if (ignore_nice) { |
153 | u64 cur_nice = kcpustat_cpu(j).cpustat[CPUTIME_NICE]; | 153 | u64 cur_nice = kcpustat_cpu(j).cpustat[CPUTIME_NICE]; |
154 | 154 | ||
155 | idle_time += cputime_to_usecs(cur_nice - j_cdbs->prev_cpu_nice); | 155 | idle_time += div_u64(cur_nice - j_cdbs->prev_cpu_nice, NSEC_PER_USEC); |
156 | j_cdbs->prev_cpu_nice = cur_nice; | 156 | j_cdbs->prev_cpu_nice = cur_nice; |
157 | } | 157 | } |
158 | 158 | ||
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c index ac284e66839c..17048bbec287 100644 --- a/drivers/cpufreq/cpufreq_stats.c +++ b/drivers/cpufreq/cpufreq_stats.c | |||
@@ -13,7 +13,6 @@ | |||
13 | #include <linux/cpufreq.h> | 13 | #include <linux/cpufreq.h> |
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
16 | #include <linux/cputime.h> | ||
17 | 16 | ||
18 | static DEFINE_SPINLOCK(cpufreq_stats_lock); | 17 | static DEFINE_SPINLOCK(cpufreq_stats_lock); |
19 | 18 | ||
diff --git a/drivers/macintosh/rack-meter.c b/drivers/macintosh/rack-meter.c index 775527135b93..c114594136d4 100644 --- a/drivers/macintosh/rack-meter.c +++ b/drivers/macintosh/rack-meter.c | |||
@@ -91,7 +91,7 @@ static inline cputime64_t get_cpu_idle_time(unsigned int cpu) | |||
91 | if (rackmeter_ignore_nice) | 91 | if (rackmeter_ignore_nice) |
92 | retval += kcpustat_cpu(cpu).cpustat[CPUTIME_NICE]; | 92 | retval += kcpustat_cpu(cpu).cpustat[CPUTIME_NICE]; |
93 | 93 | ||
94 | return retval; | 94 | return nsecs_to_cputime64(retval); |
95 | } | 95 | } |
96 | 96 | ||
97 | static void rackmeter_setup_i2s(struct rackmeter *rm) | 97 | static void rackmeter_setup_i2s(struct rackmeter *rm) |
diff --git a/fs/proc/stat.c b/fs/proc/stat.c index d700c42b3572..44475a44cbf1 100644 --- a/fs/proc/stat.c +++ b/fs/proc/stat.c | |||
@@ -21,23 +21,23 @@ | |||
21 | 21 | ||
22 | #ifdef arch_idle_time | 22 | #ifdef arch_idle_time |
23 | 23 | ||
24 | static cputime64_t get_idle_time(int cpu) | 24 | static u64 get_idle_time(int cpu) |
25 | { | 25 | { |
26 | cputime64_t idle; | 26 | u64 idle; |
27 | 27 | ||
28 | idle = kcpustat_cpu(cpu).cpustat[CPUTIME_IDLE]; | 28 | idle = kcpustat_cpu(cpu).cpustat[CPUTIME_IDLE]; |
29 | if (cpu_online(cpu) && !nr_iowait_cpu(cpu)) | 29 | if (cpu_online(cpu) && !nr_iowait_cpu(cpu)) |
30 | idle += arch_idle_time(cpu); | 30 | idle += cputime_to_nsecs(arch_idle_time(cpu)); |
31 | return idle; | 31 | return idle; |
32 | } | 32 | } |
33 | 33 | ||
34 | static cputime64_t get_iowait_time(int cpu) | 34 | static u64 get_iowait_time(int cpu) |
35 | { | 35 | { |
36 | cputime64_t iowait; | 36 | u64 iowait; |
37 | 37 | ||
38 | iowait = kcpustat_cpu(cpu).cpustat[CPUTIME_IOWAIT]; | 38 | iowait = kcpustat_cpu(cpu).cpustat[CPUTIME_IOWAIT]; |
39 | if (cpu_online(cpu) && nr_iowait_cpu(cpu)) | 39 | if (cpu_online(cpu) && nr_iowait_cpu(cpu)) |
40 | iowait += arch_idle_time(cpu); | 40 | iowait += cputime_to_nsecs(arch_idle_time(cpu)); |
41 | return iowait; | 41 | return iowait; |
42 | } | 42 | } |
43 | 43 | ||
@@ -45,32 +45,32 @@ static cputime64_t get_iowait_time(int cpu) | |||
45 | 45 | ||
46 | static u64 get_idle_time(int cpu) | 46 | static u64 get_idle_time(int cpu) |
47 | { | 47 | { |
48 | u64 idle, idle_time = -1ULL; | 48 | u64 idle, idle_usecs = -1ULL; |
49 | 49 | ||
50 | if (cpu_online(cpu)) | 50 | if (cpu_online(cpu)) |
51 | idle_time = get_cpu_idle_time_us(cpu, NULL); | 51 | idle_usecs = get_cpu_idle_time_us(cpu, NULL); |
52 | 52 | ||
53 | if (idle_time == -1ULL) | 53 | if (idle_usecs == -1ULL) |
54 | /* !NO_HZ or cpu offline so we can rely on cpustat.idle */ | 54 | /* !NO_HZ or cpu offline so we can rely on cpustat.idle */ |
55 | idle = kcpustat_cpu(cpu).cpustat[CPUTIME_IDLE]; | 55 | idle = kcpustat_cpu(cpu).cpustat[CPUTIME_IDLE]; |
56 | else | 56 | else |
57 | idle = usecs_to_cputime64(idle_time); | 57 | idle = idle_usecs * NSEC_PER_USEC; |
58 | 58 | ||
59 | return idle; | 59 | return idle; |
60 | } | 60 | } |
61 | 61 | ||
62 | static u64 get_iowait_time(int cpu) | 62 | static u64 get_iowait_time(int cpu) |
63 | { | 63 | { |
64 | u64 iowait, iowait_time = -1ULL; | 64 | u64 iowait, iowait_usecs = -1ULL; |
65 | 65 | ||
66 | if (cpu_online(cpu)) | 66 | if (cpu_online(cpu)) |
67 | iowait_time = get_cpu_iowait_time_us(cpu, NULL); | 67 | iowait_usecs = get_cpu_iowait_time_us(cpu, NULL); |
68 | 68 | ||
69 | if (iowait_time == -1ULL) | 69 | if (iowait_usecs == -1ULL) |
70 | /* !NO_HZ or cpu offline so we can rely on cpustat.iowait */ | 70 | /* !NO_HZ or cpu offline so we can rely on cpustat.iowait */ |
71 | iowait = kcpustat_cpu(cpu).cpustat[CPUTIME_IOWAIT]; | 71 | iowait = kcpustat_cpu(cpu).cpustat[CPUTIME_IOWAIT]; |
72 | else | 72 | else |
73 | iowait = usecs_to_cputime64(iowait_time); | 73 | iowait = iowait_usecs * NSEC_PER_USEC; |
74 | 74 | ||
75 | return iowait; | 75 | return iowait; |
76 | } | 76 | } |
@@ -115,16 +115,16 @@ static int show_stat(struct seq_file *p, void *v) | |||
115 | } | 115 | } |
116 | sum += arch_irq_stat(); | 116 | sum += arch_irq_stat(); |
117 | 117 | ||
118 | seq_put_decimal_ull(p, "cpu ", cputime64_to_clock_t(user)); | 118 | seq_put_decimal_ull(p, "cpu ", nsec_to_clock_t(user)); |
119 | seq_put_decimal_ull(p, " ", cputime64_to_clock_t(nice)); | 119 | seq_put_decimal_ull(p, " ", nsec_to_clock_t(nice)); |
120 | seq_put_decimal_ull(p, " ", cputime64_to_clock_t(system)); | 120 | seq_put_decimal_ull(p, " ", nsec_to_clock_t(system)); |
121 | seq_put_decimal_ull(p, " ", cputime64_to_clock_t(idle)); | 121 | seq_put_decimal_ull(p, " ", nsec_to_clock_t(idle)); |
122 | seq_put_decimal_ull(p, " ", cputime64_to_clock_t(iowait)); | 122 | seq_put_decimal_ull(p, " ", nsec_to_clock_t(iowait)); |
123 | seq_put_decimal_ull(p, " ", cputime64_to_clock_t(irq)); | 123 | seq_put_decimal_ull(p, " ", nsec_to_clock_t(irq)); |
124 | seq_put_decimal_ull(p, " ", cputime64_to_clock_t(softirq)); | 124 | seq_put_decimal_ull(p, " ", nsec_to_clock_t(softirq)); |
125 | seq_put_decimal_ull(p, " ", cputime64_to_clock_t(steal)); | 125 | seq_put_decimal_ull(p, " ", nsec_to_clock_t(steal)); |
126 | seq_put_decimal_ull(p, " ", cputime64_to_clock_t(guest)); | 126 | seq_put_decimal_ull(p, " ", nsec_to_clock_t(guest)); |
127 | seq_put_decimal_ull(p, " ", cputime64_to_clock_t(guest_nice)); | 127 | seq_put_decimal_ull(p, " ", nsec_to_clock_t(guest_nice)); |
128 | seq_putc(p, '\n'); | 128 | seq_putc(p, '\n'); |
129 | 129 | ||
130 | for_each_online_cpu(i) { | 130 | for_each_online_cpu(i) { |
@@ -140,16 +140,16 @@ static int show_stat(struct seq_file *p, void *v) | |||
140 | guest = kcpustat_cpu(i).cpustat[CPUTIME_GUEST]; | 140 | guest = kcpustat_cpu(i).cpustat[CPUTIME_GUEST]; |
141 | guest_nice = kcpustat_cpu(i).cpustat[CPUTIME_GUEST_NICE]; | 141 | guest_nice = kcpustat_cpu(i).cpustat[CPUTIME_GUEST_NICE]; |
142 | seq_printf(p, "cpu%d", i); | 142 | seq_printf(p, "cpu%d", i); |
143 | seq_put_decimal_ull(p, " ", cputime64_to_clock_t(user)); | 143 | seq_put_decimal_ull(p, " ", nsec_to_clock_t(user)); |
144 | seq_put_decimal_ull(p, " ", cputime64_to_clock_t(nice)); | 144 | seq_put_decimal_ull(p, " ", nsec_to_clock_t(nice)); |
145 | seq_put_decimal_ull(p, " ", cputime64_to_clock_t(system)); | 145 | seq_put_decimal_ull(p, " ", nsec_to_clock_t(system)); |
146 | seq_put_decimal_ull(p, " ", cputime64_to_clock_t(idle)); | 146 | seq_put_decimal_ull(p, " ", nsec_to_clock_t(idle)); |
147 | seq_put_decimal_ull(p, " ", cputime64_to_clock_t(iowait)); | 147 | seq_put_decimal_ull(p, " ", nsec_to_clock_t(iowait)); |
148 | seq_put_decimal_ull(p, " ", cputime64_to_clock_t(irq)); | 148 | seq_put_decimal_ull(p, " ", nsec_to_clock_t(irq)); |
149 | seq_put_decimal_ull(p, " ", cputime64_to_clock_t(softirq)); | 149 | seq_put_decimal_ull(p, " ", nsec_to_clock_t(softirq)); |
150 | seq_put_decimal_ull(p, " ", cputime64_to_clock_t(steal)); | 150 | seq_put_decimal_ull(p, " ", nsec_to_clock_t(steal)); |
151 | seq_put_decimal_ull(p, " ", cputime64_to_clock_t(guest)); | 151 | seq_put_decimal_ull(p, " ", nsec_to_clock_t(guest)); |
152 | seq_put_decimal_ull(p, " ", cputime64_to_clock_t(guest_nice)); | 152 | seq_put_decimal_ull(p, " ", nsec_to_clock_t(guest_nice)); |
153 | seq_putc(p, '\n'); | 153 | seq_putc(p, '\n'); |
154 | } | 154 | } |
155 | seq_put_decimal_ull(p, "intr ", (unsigned long long)sum); | 155 | seq_put_decimal_ull(p, "intr ", (unsigned long long)sum); |
diff --git a/fs/proc/uptime.c b/fs/proc/uptime.c index 33de567c25af..7981c4ffe787 100644 --- a/fs/proc/uptime.c +++ b/fs/proc/uptime.c | |||
@@ -5,23 +5,20 @@ | |||
5 | #include <linux/seq_file.h> | 5 | #include <linux/seq_file.h> |
6 | #include <linux/time.h> | 6 | #include <linux/time.h> |
7 | #include <linux/kernel_stat.h> | 7 | #include <linux/kernel_stat.h> |
8 | #include <linux/cputime.h> | ||
9 | 8 | ||
10 | static int uptime_proc_show(struct seq_file *m, void *v) | 9 | static int uptime_proc_show(struct seq_file *m, void *v) |
11 | { | 10 | { |
12 | struct timespec uptime; | 11 | struct timespec uptime; |
13 | struct timespec idle; | 12 | struct timespec idle; |
14 | u64 idletime; | ||
15 | u64 nsec; | 13 | u64 nsec; |
16 | u32 rem; | 14 | u32 rem; |
17 | int i; | 15 | int i; |
18 | 16 | ||
19 | idletime = 0; | 17 | nsec = 0; |
20 | for_each_possible_cpu(i) | 18 | for_each_possible_cpu(i) |
21 | idletime += (__force u64) kcpustat_cpu(i).cpustat[CPUTIME_IDLE]; | 19 | nsec += (__force u64) kcpustat_cpu(i).cpustat[CPUTIME_IDLE]; |
22 | 20 | ||
23 | get_monotonic_boottime(&uptime); | 21 | get_monotonic_boottime(&uptime); |
24 | nsec = cputime64_to_jiffies64(idletime) * TICK_NSEC; | ||
25 | idle.tv_sec = div_u64_rem(nsec, NSEC_PER_SEC, &rem); | 22 | idle.tv_sec = div_u64_rem(nsec, NSEC_PER_SEC, &rem); |
26 | idle.tv_nsec = rem; | 23 | idle.tv_nsec = rem; |
27 | seq_printf(m, "%lu.%02lu %lu.%02lu\n", | 24 | seq_printf(m, "%lu.%02lu %lu.%02lu\n", |
diff --git a/kernel/sched/cpuacct.c b/kernel/sched/cpuacct.c index 9add206b5608..f95ab29a45d0 100644 --- a/kernel/sched/cpuacct.c +++ b/kernel/sched/cpuacct.c | |||
@@ -297,7 +297,7 @@ static int cpuacct_stats_show(struct seq_file *sf, void *v) | |||
297 | for (stat = 0; stat < CPUACCT_STAT_NSTATS; stat++) { | 297 | for (stat = 0; stat < CPUACCT_STAT_NSTATS; stat++) { |
298 | seq_printf(sf, "%s %lld\n", | 298 | seq_printf(sf, "%s %lld\n", |
299 | cpuacct_stat_desc[stat], | 299 | cpuacct_stat_desc[stat], |
300 | (long long)cputime64_to_clock_t(val[stat])); | 300 | (long long)nsec_to_clock_t(val[stat])); |
301 | } | 301 | } |
302 | 302 | ||
303 | return 0; | 303 | return 0; |
diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c index f7c14cc71d06..61e270926e94 100644 --- a/kernel/sched/cputime.c +++ b/kernel/sched/cputime.c | |||
@@ -75,9 +75,9 @@ static cputime_t irqtime_account_update(u64 irqtime, int idx, cputime_t maxtime) | |||
75 | u64 *cpustat = kcpustat_this_cpu->cpustat; | 75 | u64 *cpustat = kcpustat_this_cpu->cpustat; |
76 | cputime_t irq_cputime; | 76 | cputime_t irq_cputime; |
77 | 77 | ||
78 | irq_cputime = nsecs_to_cputime64(irqtime) - cpustat[idx]; | 78 | irq_cputime = nsecs_to_cputime64(irqtime - cpustat[idx]); |
79 | irq_cputime = min(irq_cputime, maxtime); | 79 | irq_cputime = min(irq_cputime, maxtime); |
80 | cpustat[idx] += irq_cputime; | 80 | cpustat[idx] += cputime_to_nsecs(irq_cputime); |
81 | 81 | ||
82 | return irq_cputime; | 82 | return irq_cputime; |
83 | } | 83 | } |
@@ -140,7 +140,7 @@ void account_user_time(struct task_struct *p, cputime_t cputime) | |||
140 | index = (task_nice(p) > 0) ? CPUTIME_NICE : CPUTIME_USER; | 140 | index = (task_nice(p) > 0) ? CPUTIME_NICE : CPUTIME_USER; |
141 | 141 | ||
142 | /* Add user time to cpustat. */ | 142 | /* Add user time to cpustat. */ |
143 | task_group_account_field(p, index, (__force u64) cputime); | 143 | task_group_account_field(p, index, cputime_to_nsecs(cputime)); |
144 | 144 | ||
145 | /* Account for user time used */ | 145 | /* Account for user time used */ |
146 | acct_account_cputime(p); | 146 | acct_account_cputime(p); |
@@ -162,11 +162,11 @@ void account_guest_time(struct task_struct *p, cputime_t cputime) | |||
162 | 162 | ||
163 | /* Add guest time to cpustat. */ | 163 | /* Add guest time to cpustat. */ |
164 | if (task_nice(p) > 0) { | 164 | if (task_nice(p) > 0) { |
165 | cpustat[CPUTIME_NICE] += (__force u64) cputime; | 165 | cpustat[CPUTIME_NICE] += cputime_to_nsecs(cputime); |
166 | cpustat[CPUTIME_GUEST_NICE] += (__force u64) cputime; | 166 | cpustat[CPUTIME_GUEST_NICE] += cputime_to_nsecs(cputime); |
167 | } else { | 167 | } else { |
168 | cpustat[CPUTIME_USER] += (__force u64) cputime; | 168 | cpustat[CPUTIME_USER] += cputime_to_nsecs(cputime); |
169 | cpustat[CPUTIME_GUEST] += (__force u64) cputime; | 169 | cpustat[CPUTIME_GUEST] += cputime_to_nsecs(cputime); |
170 | } | 170 | } |
171 | } | 171 | } |
172 | 172 | ||
@@ -184,7 +184,7 @@ void account_system_index_time(struct task_struct *p, | |||
184 | account_group_system_time(p, cputime); | 184 | account_group_system_time(p, cputime); |
185 | 185 | ||
186 | /* Add system time to cpustat. */ | 186 | /* Add system time to cpustat. */ |
187 | task_group_account_field(p, index, (__force u64) cputime); | 187 | task_group_account_field(p, index, cputime_to_nsecs(cputime)); |
188 | 188 | ||
189 | /* Account for system time used */ | 189 | /* Account for system time used */ |
190 | acct_account_cputime(p); | 190 | acct_account_cputime(p); |
@@ -224,7 +224,7 @@ void account_steal_time(cputime_t cputime) | |||
224 | { | 224 | { |
225 | u64 *cpustat = kcpustat_this_cpu->cpustat; | 225 | u64 *cpustat = kcpustat_this_cpu->cpustat; |
226 | 226 | ||
227 | cpustat[CPUTIME_STEAL] += (__force u64) cputime; | 227 | cpustat[CPUTIME_STEAL] += cputime_to_nsecs(cputime); |
228 | } | 228 | } |
229 | 229 | ||
230 | /* | 230 | /* |
@@ -237,9 +237,9 @@ void account_idle_time(cputime_t cputime) | |||
237 | struct rq *rq = this_rq(); | 237 | struct rq *rq = this_rq(); |
238 | 238 | ||
239 | if (atomic_read(&rq->nr_iowait) > 0) | 239 | if (atomic_read(&rq->nr_iowait) > 0) |
240 | cpustat[CPUTIME_IOWAIT] += (__force u64) cputime; | 240 | cpustat[CPUTIME_IOWAIT] += cputime_to_nsecs(cputime); |
241 | else | 241 | else |
242 | cpustat[CPUTIME_IDLE] += (__force u64) cputime; | 242 | cpustat[CPUTIME_IDLE] += cputime_to_nsecs(cputime); |
243 | } | 243 | } |
244 | 244 | ||
245 | /* | 245 | /* |