diff options
author | jeff <jeff@FreeBSD.org> | 2007-06-01 01:12:45 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2007-06-01 01:12:45 +0000 |
commit | a7a8bac81f171b93c4770f51c694b15c84a2f9f8 (patch) | |
tree | 9c09dcc76185c3dc30b048a5f2eb972f3bb8a849 /sys/sys/resourcevar.h | |
parent | 062ed7352f59fb6db93a3f51ca6e64ec0cefca22 (diff) | |
download | FreeBSD-src-a7a8bac81f171b93c4770f51c694b15c84a2f9f8.zip FreeBSD-src-a7a8bac81f171b93c4770f51c694b15c84a2f9f8.tar.gz |
- Move rusage from being per-process in struct pstats to per-thread in
td_ru. This removes the requirement for per-process synchronization in
statclock() and mi_switch(). This was previously supported by
sched_lock which is going away. All modifications to rusage are now
done in the context of the owning thread. reads proceed without locks.
- Aggregate exiting threads rusage in thread_exit() such that the exiting
thread's rusage is not lost.
- Provide a new routine, rufetch() to fetch an aggregate of all rusage
structures from all threads in a process. This routine must be used
in any place requiring a rusage from a process prior to it's exit. The
exited process's rusage is still available via p_ru.
- Aggregate tick statistics only on demand via rufetch() or when a thread
exits. Tick statistics are kept in the thread and protected by sched_lock
until it exits.
Initial patch by: attilio
Reviewed by: attilio, bde (some objections), arch (mostly silent)
Diffstat (limited to 'sys/sys/resourcevar.h')
-rw-r--r-- | sys/sys/resourcevar.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/sys/resourcevar.h b/sys/sys/resourcevar.h index ad83370..173d7e3 100644 --- a/sys/sys/resourcevar.h +++ b/sys/sys/resourcevar.h @@ -51,8 +51,7 @@ * k - only accessed by curthread */ struct pstats { -#define pstat_startzero p_ru - struct rusage p_ru; /* Stats for this process. */ +#define pstat_startzero p_cru struct rusage p_cru; /* Stats for reaped children. */ struct itimerval p_timer[3]; /* (j) Virtual-time timers. */ #define pstat_endzero pstat_startcopy @@ -116,6 +115,7 @@ struct plimit *lim_alloc(void); void lim_copy(struct plimit *dst, struct plimit *src); rlim_t lim_cur(struct proc *p, int which); +void lim_fork(struct proc *p1, struct proc *p2); void lim_free(struct plimit *limp); struct plimit *lim_hold(struct plimit *limp); @@ -123,6 +123,9 @@ rlim_t lim_max(struct proc *p, int which); void lim_rlimit(struct proc *p, int which, struct rlimit *rlp); void ruadd(struct rusage *ru, struct rusage_ext *rux, struct rusage *ru2, struct rusage_ext *rux2); +void rufetch(struct proc *p, struct rusage *ru); +void rucollect(struct rusage *ru, struct rusage *ru2); +void ruxagg(struct rusage_ext *rux, struct thread *td); int suswintr(void *base, int word); struct uidinfo *uifind(uid_t uid); |