summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_trap.c
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2007-06-01 01:12:45 +0000
committerjeff <jeff@FreeBSD.org>2007-06-01 01:12:45 +0000
commita7a8bac81f171b93c4770f51c694b15c84a2f9f8 (patch)
tree9c09dcc76185c3dc30b048a5f2eb972f3bb8a849 /sys/kern/subr_trap.c
parent062ed7352f59fb6db93a3f51ca6e64ec0cefca22 (diff)
downloadFreeBSD-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/kern/subr_trap.c')
-rw-r--r--sys/kern/subr_trap.c20
1 files changed, 2 insertions, 18 deletions
diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c
index 15c8fdd..e9d9c35 100644
--- a/sys/kern/subr_trap.c
+++ b/sys/kern/subr_trap.c
@@ -147,7 +147,6 @@ ast(struct trapframe *framep)
{
struct thread *td;
struct proc *p;
- struct rlimit rlim;
int sflag;
int flags;
int sig;
@@ -183,8 +182,8 @@ ast(struct trapframe *framep)
mtx_lock_spin(&sched_lock);
flags = td->td_flags;
sflag = p->p_sflag;
- if (p->p_sflag & (PS_ALRMPEND | PS_PROFPEND | PS_XCPU))
- p->p_sflag &= ~(PS_ALRMPEND | PS_PROFPEND | PS_XCPU);
+ if (p->p_sflag & (PS_ALRMPEND | PS_PROFPEND))
+ p->p_sflag &= ~(PS_ALRMPEND | PS_PROFPEND);
#ifdef MAC
if (p->p_sflag & PS_MACPEND)
p->p_sflag &= ~PS_MACPEND;
@@ -231,21 +230,6 @@ ast(struct trapframe *framep)
psignal(p, SIGPROF);
PROC_UNLOCK(p);
}
- if (sflag & PS_XCPU) {
- PROC_LOCK(p);
- lim_rlimit(p, RLIMIT_CPU, &rlim);
- mtx_lock_spin(&sched_lock);
- if (p->p_rux.rux_runtime >= rlim.rlim_max * cpu_tickrate()) {
- mtx_unlock_spin(&sched_lock);
- killproc(p, "exceeded maximum CPU limit");
- } else {
- if (p->p_cpulimit < rlim.rlim_max)
- p->p_cpulimit += 5;
- mtx_unlock_spin(&sched_lock);
- psignal(p, SIGXCPU);
- }
- PROC_UNLOCK(p);
- }
#ifdef MAC
if (sflag & PS_MACPEND)
mac_thread_userret(td);
OpenPOWER on IntegriCloud