cputime: microsecond based cputime for s390.
Subsystems (2)
PATCH 1/1 cputime: microsecond based cputime for s390.
Hi Andrew,
I got no more complaints about the cputime patch, only the one about konqueror. Weelll, in this case here is the patch (against 2.6.10-rc1-mm5) that introduces micro-second based cpu accounting for s390. Perhaps one of the gurus for the other architectures wants to implement better accouting as well. Who knows?
There are a couple of other patches on their way to you. One is for 2.6.10-rc1-mm5 to correct the s390 mm defines for 4 level page tables and a set of 10 update patches against -bk.
blue skies,
Martin.
---
[patch] cputime: microsecond based cputime for s390.
From: Martin Schwidefsky <[email protected]>
This patch adds the architecture magic to replace the jiffies based cputime with microsecond based cputime and it adds code to calculate involuntary wait time. With this patch the numbers reported by top and ps when running on LPAR or z/VM are finally not junk anymore.
diffstat:
arch/s390/Kconfig | 7 + arch/s390/kernel/binfmt_elf32.c | 5 - arch/s390/kernel/entry.S | 135 ++++++++++++++++++++++++++++++- arch/s390/kernel/entry64.S | 128 ++++++++++++++++++++++++++++-- arch/s390/kernel/irq.c | 8 + arch/s390/kernel/time.c | 42 ++------- arch/s390/kernel/vtime.c | 111 ++++++++++++++++++++++---- include/asm-s390/cputime.h | 170 +++++++++++++++++++++++++++++++++++++++- include/asm-s390/hardirq.h | 3 include/asm-s390/lowcore.h | 47 +++++++++-- include/asm-s390/system.h | 18 ++++ include/asm-s390/timer.h | 2 12 files changed, 604 insertions(+), 72 deletions(-)
arch/s390/Kconfig +7 -0
@@ -366,6 +366,13 @@ This provides a kernel interface for virtual CPU timers. Default is disabled. +config VIRT_CPU_ACCOUNTING + bool "Base user process accounting on virtual cpu timer" + depends on VIRT_TIMER + help + Select this option to use CPU timer deltas to do user + process accounting. + config APPLDATA_BASE bool "Linux - VM Monitor Stream, base infrastructure" depends on PROC_FS && VIRT_TIMER=y
arch/s390/kernel/binfmt_elf32.c +2 -3
@@ -178,9 +178,8 @@static __inline__void cputime_to_compat_timeval (const cputime_t cputime,struct compat_timeval *value) { -unsigned long jiffies =cputime_to_jiffies (cputime); - value->tv_usec = (jiffies %HZ ) * (1000000L /HZ ); - value->tv_sec = jiffies /HZ ; + value->tv_usec = cputime %1000000 ; + value->tv_sec = cputime /1000000 ; }#include "../../../fs/binfmt_elf.c"
arch/s390/kernel/entry64.S +123 -5
224 lines not on this page · raw message
arch/s390/kernel/entry.S +130 -5
237 lines not on this page · raw message
arch/s390/kernel/irq.c +8 -0
@@ -71,6 +71,10 @@local_irq_save (flags); +account_system_vtime (current); + +local_bh_disable (); +if (local_softirq_pending ()) {/* Get current stack pointer. */ asmvolatile ("la %0,0(15)" :"=a" (old));
@@ -93,6 +97,10 @@__do_softirq (); } +account_system_vtime (current); + +__local_bh_enable (); +local_irq_restore (flags); }
arch/s390/kernel/time.c +11 -31
78 lines not on this page · raw message
arch/s390/kernel/vtime.c +97 -14
147 lines not on this page · raw message
include/asm-s390/cputime.h +166 -4
172 lines not on this page · raw message
include/asm-s390/hardirq.h +3 -0
@@ -16,6 +16,7 @@#include <linux/threads.h> #include <linux/sched.h> #include <linux/cache.h> +#include <linux/interrupt.h> #include <asm/lowcore.h> /* irq_cpustat_t is unused currently, but could be converted
@@ -46,10 +47,12 @@#define irq_enter () \ do { \ + account_system_vtime(current); \ (preempt_count() += HARDIRQ_OFFSET); \ } while(0)#define irq_exit () \ do { \ + account_system_vtime(current); \ preempt_count() -= IRQ_EXIT_OFFSET; \ if (!in_interrupt() && local_softirq_pending()) \/* Use the async. stack for softirq */ \
include/asm-s390/lowcore.h +39 -8
80 lines not on this page · raw message
include/asm-s390/system.h +18 -0
@@ -105,11 +105,29 @@#define prepare_arch_switch (rq, next) do { } while(0)#define task_running (rq, p) ((rq)->curr == (p)) + +#ifdef CONFIG_VIRT_CPU_ACCOUNTING +extern void account_user_vtime (struct task_struct *); +extern void account_system_vtime (struct task_struct *); + +#define finish_arch_switch (rq, prev) do { \ + set_fs(current->thread.mm_segment); \ + spin_unlock(&(rq)->lock); \ + account_system_vtime(prev); \ + local_irq_enable(); \ +} while (0) + +#else + +#define account_system_vtime (prev) +#define finish_arch_switch (rq, prev) do { \ set_fs(current->thread.mm_segment); \ spin_unlock_irq(&(rq)->lock); \ } while (0) +#endif +#define nop () __asm__ __volatile__ ("nop")#define xchg (ptr,x) \
include/asm-s390/timer.h +0 -2
@@ -37,8 +37,6 @@__u64 idle;/* temp var for idle */ }; -void set_vtimer (__u64 expires); -extern void init_virt_timer (struct vtimer_list *timer);extern void add_virt_timer (void *new);extern void add_virt_timer_periodic (void *new);