summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_meter.c
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>2002-06-29 17:26:22 +0000
committerjulian <julian@FreeBSD.org>2002-06-29 17:26:22 +0000
commitaa2dc0a5d9e7a19420c153cd414fefa8498eab71 (patch)
tree0a0483a267784fa8e2bf86857d8727edb5b122e9 /sys/vm/vm_meter.c
parent6dbff7f2c1f8150887038aed666e11675adf0b4e (diff)
downloadFreeBSD-src-aa2dc0a5d9e7a19420c153cd414fefa8498eab71.zip
FreeBSD-src-aa2dc0a5d9e7a19420c153cd414fefa8498eab71.tar.gz
Part 1 of KSE-III
The ability to schedule multiple threads per process (one one cpu) by making ALL system calls optionally asynchronous. to come: ia64 and power-pc patches, patches for gdb, test program (in tools) Reviewed by: Almost everyone who counts (at various times, peter, jhb, matt, alfred, mini, bernd, and a cast of thousands) NOTE: this is still Beta code, and contains lots of debugging stuff. expect slight instability in signals..
Diffstat (limited to 'sys/vm/vm_meter.c')
-rw-r--r--sys/vm/vm_meter.c71
1 files changed, 39 insertions, 32 deletions
diff --git a/sys/vm/vm_meter.c b/sys/vm/vm_meter.c
index 935979ae..a1b8adb 100644
--- a/sys/vm/vm_meter.c
+++ b/sys/vm/vm_meter.c
@@ -81,6 +81,7 @@ SYSCTL_STRUCT(_vm, VM_LOADAVG, loadavg, CTLFLAG_RD,
static int
vmtotal(SYSCTL_HANDLER_ARGS)
{
+/* XXXKSE almost completely broken */
struct proc *p;
struct vmtotal total, *totalp;
vm_map_entry_t entry;
@@ -88,6 +89,7 @@ vmtotal(SYSCTL_HANDLER_ARGS)
vm_map_t map;
int paging;
struct ksegrp *kg;
+ struct thread *td;
totalp = &total;
bzero(totalp, sizeof *totalp);
@@ -107,44 +109,49 @@ vmtotal(SYSCTL_HANDLER_ARGS)
if (p->p_flag & P_SYSTEM)
continue;
mtx_lock_spin(&sched_lock);
- switch (p->p_stat) {
- case 0:
+ switch (p->p_state) {
+ case PRS_NEW:
+ if (p->p_sflag & PS_INMEM)
+ totalp->t_rq++;
+ else
+ totalp->t_sw++;
mtx_unlock_spin(&sched_lock);
continue;
-
- case SMTX:
- case SSLEEP:
- case SSTOP:
- kg = &p->p_ksegrp; /* XXXKSE */
- if (p->p_sflag & PS_INMEM) {
- if (FIRST_THREAD_IN_PROC(p)->td_priority
- <= PZERO)
- totalp->t_dw++;
- else if (kg->kg_slptime < maxslp)
- totalp->t_sl++;
- } else if (kg->kg_slptime < maxslp)
- totalp->t_sw++;
- if (kg->kg_slptime >= maxslp) {
- mtx_unlock_spin(&sched_lock);
- continue;
- }
break;
+ default:
+ FOREACH_THREAD_IN_PROC(p, td) {
+ switch (td->td_state) {
+ case TDS_MTX:
+ case TDS_SLP:
+ kg = td->td_ksegrp; /* XXXKSE */
+ if (p->p_sflag & PS_INMEM) {
+ if (td->td_priority <= PZERO)
+ totalp->t_dw++;
+ else if (kg->kg_slptime
+ < maxslp)
+ totalp->t_sl++;
+ } else if (kg->kg_slptime < maxslp)
+ totalp->t_sw++;
+ if (kg->kg_slptime >= maxslp) {
+ continue;
+ }
+ break;
- case SWAIT:
- totalp->t_sl++;
- continue;
+ case TDS_RUNQ:
+ case TDS_RUNNING:
+ if (p->p_sflag & PS_INMEM)
+ totalp->t_rq++;
+ else
+ totalp->t_sw++;
+ continue;
- case SRUN:
- case SIDL:
- if (p->p_sflag & PS_INMEM)
- totalp->t_rq++;
- else
- totalp->t_sw++;
- if (p->p_stat == SIDL) {
- mtx_unlock_spin(&sched_lock);
- continue;
+ case TDS_IWAIT:
+ totalp->t_sl++;
+ continue;
+ default:
+ break;
+ }
}
- break;
}
mtx_unlock_spin(&sched_lock);
/*
OpenPOWER on IntegriCloud