diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2009-05-02 14:08:52 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2009-05-15 09:32:45 -0400 |
commit | 2d02494f5a90f2e4b3c4c6acc85ec94674cdc431 (patch) | |
tree | 8032438de5b55282976583b111d02d9379ff3966 /kernel/timer.c | |
parent | dce48a84adf1806676319f6f480e30a6daa012f9 (diff) |
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 'kernel/timer.c')
-rw-r--r-- | kernel/timer.c | 32 |
1 files changed, 6 insertions, 26 deletions
diff --git a/kernel/timer.c b/kernel/timer.c index 6a21d7af9620..a26ed294f938 100644 --- a/kernel/timer.c +++ b/kernel/timer.c | |||
@@ -1356,37 +1356,17 @@ int do_sysinfo(struct sysinfo *info) | |||
1356 | { | 1356 | { |
1357 | unsigned long mem_total, sav_total; | 1357 | unsigned long mem_total, sav_total; |
1358 | unsigned int mem_unit, bitcount; | 1358 | unsigned int mem_unit, bitcount; |
1359 | unsigned long seq; | 1359 | struct timespec tp; |
1360 | 1360 | ||
1361 | memset(info, 0, sizeof(struct sysinfo)); | 1361 | memset(info, 0, sizeof(struct sysinfo)); |
1362 | 1362 | ||
1363 | do { | 1363 | ktime_get_ts(&tp); |
1364 | struct timespec tp; | 1364 | monotonic_to_bootbased(&tp); |
1365 | seq = read_seqbegin(&xtime_lock); | 1365 | info->uptime = tp.tv_sec + (tp.tv_nsec ? 1 : 0); |
1366 | |||
1367 | /* | ||
1368 | * This is annoying. The below is the same thing | ||
1369 | * posix_get_clock_monotonic() does, but it wants to | ||
1370 | * take the lock which we want to cover the loads stuff | ||
1371 | * too. | ||
1372 | */ | ||
1373 | |||
1374 | getnstimeofday(&tp); | ||
1375 | tp.tv_sec += wall_to_monotonic.tv_sec; | ||
1376 | tp.tv_nsec += wall_to_monotonic.tv_nsec; | ||
1377 | monotonic_to_bootbased(&tp); | ||
1378 | if (tp.tv_nsec - NSEC_PER_SEC >= 0) { | ||
1379 | tp.tv_nsec = tp.tv_nsec - NSEC_PER_SEC; | ||
1380 | tp.tv_sec++; | ||
1381 | } | ||
1382 | info->uptime = tp.tv_sec + (tp.tv_nsec ? 1 : 0); | ||
1383 | 1366 | ||
1384 | info->loads[0] = avenrun[0] << (SI_LOAD_SHIFT - FSHIFT); | 1367 | get_avenrun(info->loads, 0, SI_LOAD_SHIFT - FSHIFT); |
1385 | info->loads[1] = avenrun[1] << (SI_LOAD_SHIFT - FSHIFT); | ||
1386 | info->loads[2] = avenrun[2] << (SI_LOAD_SHIFT - FSHIFT); | ||
1387 | 1368 | ||
1388 | info->procs = nr_threads; | 1369 | info->procs = nr_threads; |
1389 | } while (read_seqretry(&xtime_lock, seq)); | ||
1390 | 1370 | ||
1391 | si_meminfo(info); | 1371 | si_meminfo(info); |
1392 | si_swapinfo(info); | 1372 | si_swapinfo(info); |