@@ -120,20 +120,23 @@ static int show_stat(struct seq_file *p, void *v)
120
120
getboottime64 (& boottime );
121
121
122
122
for_each_possible_cpu (i ) {
123
- struct kernel_cpustat * kcs = & kcpustat_cpu (i );
124
-
125
- user += kcs -> cpustat [CPUTIME_USER ];
126
- nice += kcs -> cpustat [CPUTIME_NICE ];
127
- system += kcpustat_field (kcs , CPUTIME_SYSTEM , i );
128
- idle += get_idle_time (kcs , i );
129
- iowait += get_iowait_time (kcs , i );
130
- irq += kcs -> cpustat [CPUTIME_IRQ ];
131
- softirq += kcs -> cpustat [CPUTIME_SOFTIRQ ];
132
- steal += kcs -> cpustat [CPUTIME_STEAL ];
133
- guest += kcs -> cpustat [CPUTIME_GUEST ];
134
- guest_nice += kcs -> cpustat [CPUTIME_GUEST_NICE ];
135
- sum += kstat_cpu_irqs_sum (i );
136
- sum += arch_irq_stat_cpu (i );
123
+ struct kernel_cpustat kcpustat ;
124
+ u64 * cpustat = kcpustat .cpustat ;
125
+
126
+ kcpustat_cpu_fetch (& kcpustat , i );
127
+
128
+ user += cpustat [CPUTIME_USER ];
129
+ nice += cpustat [CPUTIME_NICE ];
130
+ system += cpustat [CPUTIME_SYSTEM ];
131
+ idle += get_idle_time (& kcpustat , i );
132
+ iowait += get_iowait_time (& kcpustat , i );
133
+ irq += cpustat [CPUTIME_IRQ ];
134
+ softirq += cpustat [CPUTIME_SOFTIRQ ];
135
+ steal += cpustat [CPUTIME_STEAL ];
136
+ guest += cpustat [CPUTIME_GUEST ];
137
+ guest_nice += cpustat [CPUTIME_USER ];
138
+ sum += kstat_cpu_irqs_sum (i );
139
+ sum += arch_irq_stat_cpu (i );
137
140
138
141
for (j = 0 ; j < NR_SOFTIRQS ; j ++ ) {
139
142
unsigned int softirq_stat = kstat_softirqs_cpu (j , i );
@@ -157,19 +160,22 @@ static int show_stat(struct seq_file *p, void *v)
157
160
seq_putc (p , '\n' );
158
161
159
162
for_each_online_cpu (i ) {
160
- struct kernel_cpustat * kcs = & kcpustat_cpu (i );
163
+ struct kernel_cpustat kcpustat ;
164
+ u64 * cpustat = kcpustat .cpustat ;
165
+
166
+ kcpustat_cpu_fetch (& kcpustat , i );
161
167
162
168
/* Copy values here to work around gcc-2.95.3, gcc-2.96 */
163
- user = kcs -> cpustat [CPUTIME_USER ];
164
- nice = kcs -> cpustat [CPUTIME_NICE ];
165
- system = kcpustat_field ( kcs , CPUTIME_SYSTEM , i ) ;
166
- idle = get_idle_time (kcs , i );
167
- iowait = get_iowait_time (kcs , i );
168
- irq = kcs -> cpustat [CPUTIME_IRQ ];
169
- softirq = kcs -> cpustat [CPUTIME_SOFTIRQ ];
170
- steal = kcs -> cpustat [CPUTIME_STEAL ];
171
- guest = kcs -> cpustat [CPUTIME_GUEST ];
172
- guest_nice = kcs -> cpustat [CPUTIME_GUEST_NICE ];
169
+ user = cpustat [CPUTIME_USER ];
170
+ nice = cpustat [CPUTIME_NICE ];
171
+ system = cpustat [ CPUTIME_SYSTEM ] ;
172
+ idle = get_idle_time (& kcpustat , i );
173
+ iowait = get_iowait_time (& kcpustat , i );
174
+ irq = cpustat [CPUTIME_IRQ ];
175
+ softirq = cpustat [CPUTIME_SOFTIRQ ];
176
+ steal = cpustat [CPUTIME_STEAL ];
177
+ guest = cpustat [CPUTIME_GUEST ];
178
+ guest_nice = cpustat [CPUTIME_USER ];
173
179
seq_printf (p , "cpu%d" , i );
174
180
seq_put_decimal_ull (p , " " , nsec_to_clock_t (user ));
175
181
seq_put_decimal_ull (p , " " , nsec_to_clock_t (nice ));
0 commit comments