cvs commit: src/sys/alpha/osf1 osf1_misc.c src/sys/amd64/linux32
linux32_machdep.c src/sys/compat/freebsd32 freebsd32_misc.c
src/sys/compat/linux linux_misc.c src/sys/compat/svr4 svr4_misc.c
src/sys/fs/procfs procfs_status.c src/sys/kern init_main.c ...
John Baldwin
jhb at FreeBSD.org
Tue Oct 5 11:51:12 PDT 2004
jhb 2004-10-05 18:51:12 UTC
FreeBSD src repository
Modified files:
sys/alpha/osf1 osf1_misc.c
sys/amd64/linux32 linux32_machdep.c
sys/compat/freebsd32 freebsd32_misc.c
sys/compat/linux linux_misc.c
sys/compat/svr4 svr4_misc.c
sys/fs/procfs procfs_status.c
sys/kern init_main.c kern_acct.c kern_clock.c
kern_exit.c kern_proc.c kern_resource.c
kern_synch.c kern_time.c subr_trap.c
tty.c
sys/sys proc.h resourcevar.h syscallsubr.h
Log:
Rework how we store process times in the kernel such that we always store
the raw values including for child process statistics and only compute the
system and user timevals on demand.
- Fix the various kern_wait() syscall wrappers to only pass in a rusage
pointer if they are going to use the result.
- Add a kern_getrusage() function for the ABI syscalls to use so that they
don't have to play stackgap games to call getrusage().
- Fix the svr4_sys_times() syscall to just call calcru() to calculate the
times it needs rather than calling getrusage() twice with associated
stackgap, etc.
- Add a new rusage_ext structure to store raw time stats such as tick counts
for user, system, and interrupt time as well as a bintime of the total
runtime. A new p_rux field in struct proc replaces the same inline fields
from struct proc (i.e. p_[isu]ticks, p_[isu]u, and p_runtime). A new p_crux
field in struct proc contains the "raw" child time usage statistics.
ruadd() has been changed to handle adding the associated rusage_ext
structures as well as the values in rusage. Effectively, the values in
rusage_ext replace the ru_utime and ru_stime values in struct rusage. These
two fields in struct rusage are no longer used in the kernel.
- calcru() has been split into a static worker function calcru1() that
calculates appropriate timevals for user and system time as well as updating
the rux_[isu]u fields of a passed in rusage_ext structure. calcru() uses a
copy of the process' p_rux structure to compute the timevals after updating
the runtime appropriately if any of the threads in that process are
currently executing. It also now only locks sched_lock internally while
doing the rux_runtime fixup. calcru() now only requires the caller to
hold the proc lock and calcru1() only requires the proc lock internally.
calcru() also no longer allows callers to ask for an interrupt timeval
since none of them actually did.
- calcru() now correctly handles threads executing on other CPUs.
- A new calccru() function computes the child system and user timevals by
calling calcru1() on p_crux. Note that this means that any code that wants
child times must now call this function rather than reading from p_cru
directly. This function also requires the proc lock.
- This finishes the locking for rusage and friends so some of the Giant locks
in exit1() and kern_wait() are now gone.
- The locking in ttyinfo() has been tweaked so that a shared lock of the
proctree lock is used to protect the process group rather than the process
group lock. By holding this lock until the end of the function we now
ensure that the process/thread that we pick to dump info about will no
longer vanish while we are trying to output its info to the console.
Submitted by: bde (mostly)
MFC after: 1 month
Revision Changes Path
1.49 +14 -23 src/sys/alpha/osf1/osf1_misc.c
1.5 +5 -15 src/sys/amd64/linux32/linux32_machdep.c
1.24 +11 -17 src/sys/compat/freebsd32/freebsd32_misc.c
1.161 +17 -11 src/sys/compat/linux/linux_misc.c
1.74 +26 -43 src/sys/compat/svr4/svr4_misc.c
1.53 +2 -3 src/sys/fs/procfs/procfs_status.c
1.249 +2 -2 src/sys/kern/init_main.c
1.72 +1 -3 src/sys/kern/kern_acct.c
1.173 +4 -4 src/sys/kern/kern_clock.c
1.250 +17 -19 src/sys/kern/kern_exit.c
1.218 +12 -13 src/sys/kern/kern_proc.c
1.146 +113 -79 src/sys/kern/kern_resource.c
1.262 +3 -3 src/sys/kern/kern_synch.c
1.109 +8 -6 src/sys/kern/kern_time.c
1.275 +1 -1 src/sys/kern/subr_trap.c
1.235 +9 -6 src/sys/kern/tty.c
1.406 +22 -7 src/sys/sys/proc.h
1.46 +5 -3 src/sys/sys/resourcevar.h
1.13 +2 -0 src/sys/sys/syscallsubr.h
More information about the cvs-src
mailing list