]> git.neil.brown.name Git - history.git/commit
[PATCH] cputime: introduce cputime
authorMartin Schwidefsky <schwidefsky@de.ibm.com>
Tue, 11 Jan 2005 09:40:38 +0000 (01:40 -0800)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Tue, 11 Jan 2005 09:40:38 +0000 (01:40 -0800)
commit0a71336b6a8858a525007c5b4e0d14ba57f9f315
tree12bf4f03dc9747a5cc401bc53f27fcdee13a7ef8
parent0fada656bc0fbf5403cb7e629a836bfb77e7c096
[PATCH] cputime: introduce cputime

This patch introduces the concept of (virtual) cputime.  Each architecture
can define its method to measure cputime.  The main idea is to define a
cputime_t type and a set of operations on it (see asm-generic/cputime.h).
Then use the type for utime, stime, cutime, cstime, it_virt_value,
it_virt_incr, it_prof_value and it_prof_incr and use the cputime operations
for each access to these variables.  The default implementation is jiffies
based and the effect of this patch for architectures which use the default
implementation should be neglectible.

There is a second type cputime64_t which is necessary for the kernel_stat
cpu statistics.  The default cputime_t is 32 bit and based on HZ, this will
overflow after 49.7 days.  This is not enough for kernel_stat (ihmo not
enough for a processes too), so it is necessary to have a 64 bit type.

The third thing that gets introduced by this patch is an additional field
for the /proc/stat interface: cpu steal time.  An architecture can account
cpu steal time by calls to the account_stealtime function.  The cpu which
backs a virtual processor doesn't spent all of its time for the virtual
cpu.  To get meaningful cpu usage numbers this involuntary wait time needs
to be accounted and exported to user space.

From: Hugh Dickins <hugh@veritas.com>

The p->signal check in account_system_time is insufficient.  If the timer
interrupt hits near the end of exit_notify, after EXIT_ZOMBIE has been set,
another cpu may release_task (NULLifying p->signal) in between
account_system_time's check and check_rlimit's dereference.  Nor should
account_it_prof risk send_sig.  But surely account_user_time is safe?

Signed-off-by: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
42 files changed:
arch/parisc/kernel/binfmt_elf32.c
arch/ppc64/kernel/binfmt_elf32.c
arch/s390/kernel/binfmt_elf32.c
arch/sparc64/kernel/binfmt_elf32.c
fs/binfmt_elf.c
fs/proc/array.c
fs/proc/proc_misc.c
include/asm-alpha/cputime.h [new file with mode: 0644]
include/asm-arm/cputime.h [new file with mode: 0644]
include/asm-arm26/cputime.h [new file with mode: 0644]
include/asm-cris/cputime.h [new file with mode: 0644]
include/asm-generic/cputime.h [new file with mode: 0644]
include/asm-h8300/cputime.h [new file with mode: 0644]
include/asm-i386/cputime.h [new file with mode: 0644]
include/asm-ia64/cputime.h [new file with mode: 0644]
include/asm-m32r/cputime.h [new file with mode: 0644]
include/asm-m68k/cputime.h [new file with mode: 0644]
include/asm-m68knommu/cputime.h [new file with mode: 0644]
include/asm-mips/cputime.h [new file with mode: 0644]
include/asm-parisc/cputime.h [new file with mode: 0644]
include/asm-ppc/cputime.h [new file with mode: 0644]
include/asm-ppc64/cputime.h [new file with mode: 0644]
include/asm-s390/cputime.h [new file with mode: 0644]
include/asm-sh/cputime.h [new file with mode: 0644]
include/asm-sh64/cputime.h [new file with mode: 0644]
include/asm-sparc/cputime.h [new file with mode: 0644]
include/asm-sparc64/cputime.h [new file with mode: 0644]
include/asm-um/cputime.h [new file with mode: 0644]
include/asm-v850/cputime.h [new file with mode: 0644]
include/asm-x86_64/cputime.h [new file with mode: 0644]
include/linux/kernel_stat.h
include/linux/sched.h
kernel/compat.c
kernel/cpu.c
kernel/exit.c
kernel/fork.c
kernel/itimer.c
kernel/sched.c
kernel/signal.c
kernel/sys.c
kernel/timer.c
mm/oom_kill.c