svn commit: r184438 - head/sys/kern

David Xu davidxu at FreeBSD.org
Wed Oct 29 05:11:49 PDT 2008


Author: davidxu
Date: Wed Oct 29 12:11:48 2008
New Revision: 184438
URL: http://svn.freebsd.org/changeset/base/184438

Log:
  If threads limit is exceeded, increase the totoal number
  of failures.

Modified:
  head/sys/kern/kern_thr.c

Modified: head/sys/kern/kern_thr.c
==============================================================================
--- head/sys/kern/kern_thr.c	Wed Oct 29 11:03:15 2008	(r184437)
+++ head/sys/kern/kern_thr.c	Wed Oct 29 12:11:48 2008	(r184438)
@@ -76,6 +76,7 @@ suword_lwpid(void *addr, lwpid_t lwpid)
 #endif
 
 extern int max_threads_per_proc;
+extern int max_threads_hits;
 
 static int create_thread(struct thread *td, mcontext_t *ctx,
 			 void (*start_func)(void *), void *arg,
@@ -154,8 +155,10 @@ create_thread(struct thread *td, mcontex
 	p = td->td_proc;
 
 	/* Have race condition but it is cheap. */
-	if (p->p_numthreads >= max_threads_per_proc)
+	if (p->p_numthreads >= max_threads_per_proc) {
+		++max_threads_hits;
 		return (EPROCLIM);
+	}
 
 	if (rtp != NULL) {
 		switch(rtp->type) {


More information about the svn-src-all mailing list