diff options
author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2011-12-15 08:56:09 -0500 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2011-12-15 08:56:19 -0500 |
commit | 648616343cdbe904c585a6c12e323d3b3c72e46f (patch) | |
tree | 514bce1b52663db4ab5662b637c764cf3c2ed1eb /fs | |
parent | 55b02d2f4445ad625213817a1736bf2884d32547 (diff) |
[S390] cputime: add sparse checking and cleanup
Make cputime_t and cputime64_t nocast to enable sparse checking to
detect incorrect use of cputime. Drop the cputime macros for simple
scalar operations. The conversion macros are still needed.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/proc/array.c | 8 | ||||
-rw-r--r-- | fs/proc/stat.c | 27 | ||||
-rw-r--r-- | fs/proc/uptime.c | 4 |
3 files changed, 19 insertions, 20 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c index 3a1dafd228d1..8c344f037bd0 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c | |||
@@ -394,8 +394,8 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns, | |||
394 | 394 | ||
395 | sigemptyset(&sigign); | 395 | sigemptyset(&sigign); |
396 | sigemptyset(&sigcatch); | 396 | sigemptyset(&sigcatch); |
397 | cutime = cstime = utime = stime = cputime_zero; | 397 | cutime = cstime = utime = stime = 0; |
398 | cgtime = gtime = cputime_zero; | 398 | cgtime = gtime = 0; |
399 | 399 | ||
400 | if (lock_task_sighand(task, &flags)) { | 400 | if (lock_task_sighand(task, &flags)) { |
401 | struct signal_struct *sig = task->signal; | 401 | struct signal_struct *sig = task->signal; |
@@ -423,14 +423,14 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns, | |||
423 | do { | 423 | do { |
424 | min_flt += t->min_flt; | 424 | min_flt += t->min_flt; |
425 | maj_flt += t->maj_flt; | 425 | maj_flt += t->maj_flt; |
426 | gtime = cputime_add(gtime, t->gtime); | 426 | gtime += t->gtime; |
427 | t = next_thread(t); | 427 | t = next_thread(t); |
428 | } while (t != task); | 428 | } while (t != task); |
429 | 429 | ||
430 | min_flt += sig->min_flt; | 430 | min_flt += sig->min_flt; |
431 | maj_flt += sig->maj_flt; | 431 | maj_flt += sig->maj_flt; |
432 | thread_group_times(task, &utime, &stime); | 432 | thread_group_times(task, &utime, &stime); |
433 | gtime = cputime_add(gtime, sig->gtime); | 433 | gtime += sig->gtime; |
434 | } | 434 | } |
435 | 435 | ||
436 | sid = task_session_nr_ns(task, ns); | 436 | sid = task_session_nr_ns(task, ns); |
diff --git a/fs/proc/stat.c b/fs/proc/stat.c index 2a30d67dd6b8..714d5d131e76 100644 --- a/fs/proc/stat.c +++ b/fs/proc/stat.c | |||
@@ -30,7 +30,7 @@ static cputime64_t get_idle_time(int cpu) | |||
30 | if (idle_time == -1ULL) { | 30 | if (idle_time == -1ULL) { |
31 | /* !NO_HZ so we can rely on cpustat.idle */ | 31 | /* !NO_HZ so we can rely on cpustat.idle */ |
32 | idle = kstat_cpu(cpu).cpustat.idle; | 32 | idle = kstat_cpu(cpu).cpustat.idle; |
33 | idle = cputime64_add(idle, arch_idle_time(cpu)); | 33 | idle += arch_idle_time(cpu); |
34 | } else | 34 | } else |
35 | idle = nsecs_to_jiffies64(1000 * idle_time); | 35 | idle = nsecs_to_jiffies64(1000 * idle_time); |
36 | 36 | ||
@@ -63,23 +63,22 @@ static int show_stat(struct seq_file *p, void *v) | |||
63 | struct timespec boottime; | 63 | struct timespec boottime; |
64 | 64 | ||
65 | user = nice = system = idle = iowait = | 65 | user = nice = system = idle = iowait = |
66 | irq = softirq = steal = cputime64_zero; | 66 | irq = softirq = steal = 0; |
67 | guest = guest_nice = cputime64_zero; | 67 | guest = guest_nice = 0; |
68 | getboottime(&boottime); | 68 | getboottime(&boottime); |
69 | jif = boottime.tv_sec; | 69 | jif = boottime.tv_sec; |
70 | 70 | ||
71 | for_each_possible_cpu(i) { | 71 | for_each_possible_cpu(i) { |
72 | user = cputime64_add(user, kstat_cpu(i).cpustat.user); | 72 | user += kstat_cpu(i).cpustat.user; |
73 | nice = cputime64_add(nice, kstat_cpu(i).cpustat.nice); | 73 | nice += kstat_cpu(i).cpustat.nice; |
74 | system = cputime64_add(system, kstat_cpu(i).cpustat.system); | 74 | system += kstat_cpu(i).cpustat.system; |
75 | idle = cputime64_add(idle, get_idle_time(i)); | 75 | idle += get_idle_time(i); |
76 | iowait = cputime64_add(iowait, get_iowait_time(i)); | 76 | iowait += get_iowait_time(i); |
77 | irq = cputime64_add(irq, kstat_cpu(i).cpustat.irq); | 77 | irq += kstat_cpu(i).cpustat.irq; |
78 | softirq = cputime64_add(softirq, kstat_cpu(i).cpustat.softirq); | 78 | softirq += kstat_cpu(i).cpustat.softirq; |
79 | steal = cputime64_add(steal, kstat_cpu(i).cpustat.steal); | 79 | steal += kstat_cpu(i).cpustat.steal; |
80 | guest = cputime64_add(guest, kstat_cpu(i).cpustat.guest); | 80 | guest += kstat_cpu(i).cpustat.guest; |
81 | guest_nice = cputime64_add(guest_nice, | 81 | guest_nice += kstat_cpu(i).cpustat.guest_nice; |
82 | kstat_cpu(i).cpustat.guest_nice); | ||
83 | sum += kstat_cpu_irqs_sum(i); | 82 | sum += kstat_cpu_irqs_sum(i); |
84 | sum += arch_irq_stat_cpu(i); | 83 | sum += arch_irq_stat_cpu(i); |
85 | 84 | ||
diff --git a/fs/proc/uptime.c b/fs/proc/uptime.c index 766b1d456050..ac5243657da3 100644 --- a/fs/proc/uptime.c +++ b/fs/proc/uptime.c | |||
@@ -12,10 +12,10 @@ static int uptime_proc_show(struct seq_file *m, void *v) | |||
12 | struct timespec uptime; | 12 | struct timespec uptime; |
13 | struct timespec idle; | 13 | struct timespec idle; |
14 | int i; | 14 | int i; |
15 | cputime_t idletime = cputime_zero; | 15 | cputime_t idletime = 0; |
16 | 16 | ||
17 | for_each_possible_cpu(i) | 17 | for_each_possible_cpu(i) |
18 | idletime = cputime64_add(idletime, kstat_cpu(i).cpustat.idle); | 18 | idletime += kstat_cpu(i).cpustat.idle; |
19 | 19 | ||
20 | do_posix_clock_monotonic_gettime(&uptime); | 20 | do_posix_clock_monotonic_gettime(&uptime); |
21 | monotonic_to_bootbased(&uptime); | 21 | monotonic_to_bootbased(&uptime); |