diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2009-05-02 20:08:52 +0200 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2009-05-15 15:32:45 +0200 |
commit | 2d02494f5a90f2e4b3c4c6acc85ec94674cdc431 (patch) | |
tree | 8032438de5b55282976583b111d02d9379ff3966 /fs/proc/loadavg.c | |
parent | sched, timers: move calc_load() to scheduler (diff) | |
download | linux-2d02494f5a90f2e4b3c4c6acc85ec94674cdc431.tar.xz linux-2d02494f5a90f2e4b3c4c6acc85ec94674cdc431.zip |
sched, timers: cleanup avenrun users
avenrun is an rough estimate so we don't have to worry about
consistency of the three avenrun values. Remove the xtime lock
dependency and provide a function to scale the values. Cleanup the
users.
[ Impact: cleanup ]
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Diffstat (limited to 'fs/proc/loadavg.c')
-rw-r--r-- | fs/proc/loadavg.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/fs/proc/loadavg.c b/fs/proc/loadavg.c index 9bca39cf99ee..1afa4dd4cae2 100644 --- a/fs/proc/loadavg.c +++ b/fs/proc/loadavg.c @@ -12,20 +12,14 @@ static int loadavg_proc_show(struct seq_file *m, void *v) { - int a, b, c; - unsigned long seq; + unsigned long avnrun[3]; - do { - seq = read_seqbegin(&xtime_lock); - a = avenrun[0] + (FIXED_1/200); - b = avenrun[1] + (FIXED_1/200); - c = avenrun[2] + (FIXED_1/200); - } while (read_seqretry(&xtime_lock, seq)); + get_avenrun(avnrun, FIXED_1/200, 0); - seq_printf(m, "%d.%02d %d.%02d %d.%02d %ld/%d %d\n", - LOAD_INT(a), LOAD_FRAC(a), - LOAD_INT(b), LOAD_FRAC(b), - LOAD_INT(c), LOAD_FRAC(c), + seq_printf(m, "%lu.%02lu %lu.%02lu %lu.%02lu %ld/%d %d\n", + LOAD_INT(avnrun[0]), LOAD_FRAC(avnrun[0]), + LOAD_INT(avnrun[1]), LOAD_FRAC(avnrun[1]), + LOAD_INT(avnrun[2]), LOAD_FRAC(avnrun[2]), nr_running(), nr_threads, task_active_pid_ns(current)->last_pid); return 0; |