summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2003-02-19 13:40:24 +0000
committerdavidxu <davidxu@FreeBSD.org>2003-02-19 13:40:24 +0000
commite0c2153011e9f04c4a6984a2df6dd265c274b5df (patch)
tree102c59cefd1afb247e55e8c3fe08012918844dea
parent0d18aacb0c875fcd13ddda53f9ad88971e43f3bc (diff)
downloadFreeBSD-src-e0c2153011e9f04c4a6984a2df6dd265c274b5df.zip
FreeBSD-src-e0c2153011e9f04c4a6984a2df6dd265c274b5df.tar.gz
Count non-threaded group.
-rw-r--r--sys/kern/kern_kse.c15
-rw-r--r--sys/kern/kern_thread.c15
2 files changed, 20 insertions, 10 deletions
diff --git a/sys/kern/kern_kse.c b/sys/kern/kern_kse.c
index c7b8843..0146cc4 100644
--- a/sys/kern/kern_kse.c
+++ b/sys/kern/kern_kse.c
@@ -1692,14 +1692,18 @@ out:
break;
upcalls = 0;
mtx_lock_spin(&sched_lock);
- FOREACH_KSEGRP_IN_PROC(p, kg2)
- upcalls += kg2->kg_numupcalls;
+ FOREACH_KSEGRP_IN_PROC(p, kg2) {
+ if (kg2->kg_numupcalls == 0)
+ upcalls++;
+ else
+ upcalls += kg2->kg_numupcalls;
+ }
mtx_unlock_spin(&sched_lock);
if (upcalls >= max_threads_per_proc)
break;
p->p_maxthrwaits++;
- msleep(&p->p_numthreads, &p->p_mtx, PPAUSE|PCATCH, "maxthreads",
- NULL);
+ msleep(&p->p_numthreads, &p->p_mtx, PPAUSE|PCATCH,
+ "maxthreads", NULL);
p->p_maxthrwaits--;
}
PROC_UNLOCK(p);
@@ -1707,7 +1711,8 @@ out:
if (error) {
/*
- * Things are going to be so screwed we should just kill the process.
+ * Things are going to be so screwed we should just kill
+ * the process.
* how do we do that?
*/
PROC_LOCK(td->td_proc);
diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c
index c7b8843..0146cc4 100644
--- a/sys/kern/kern_thread.c
+++ b/sys/kern/kern_thread.c
@@ -1692,14 +1692,18 @@ out:
break;
upcalls = 0;
mtx_lock_spin(&sched_lock);
- FOREACH_KSEGRP_IN_PROC(p, kg2)
- upcalls += kg2->kg_numupcalls;
+ FOREACH_KSEGRP_IN_PROC(p, kg2) {
+ if (kg2->kg_numupcalls == 0)
+ upcalls++;
+ else
+ upcalls += kg2->kg_numupcalls;
+ }
mtx_unlock_spin(&sched_lock);
if (upcalls >= max_threads_per_proc)
break;
p->p_maxthrwaits++;
- msleep(&p->p_numthreads, &p->p_mtx, PPAUSE|PCATCH, "maxthreads",
- NULL);
+ msleep(&p->p_numthreads, &p->p_mtx, PPAUSE|PCATCH,
+ "maxthreads", NULL);
p->p_maxthrwaits--;
}
PROC_UNLOCK(p);
@@ -1707,7 +1711,8 @@ out:
if (error) {
/*
- * Things are going to be so screwed we should just kill the process.
+ * Things are going to be so screwed we should just kill
+ * the process.
* how do we do that?
*/
PROC_LOCK(td->td_proc);
OpenPOWER on IntegriCloud