Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Feb 2011 11:16:48 +0000
From:      Alexander Best <arundel@freebsd.org>
To:        freebsd-hackers@freebsd.org
Subject:   [patch] off by one issue in sys/kern/kern_thr.c
Message-ID:  <20110223111648.GA41592@freebsd.org>

next in thread | raw e-mail | index | archive | help

--DocE+STaALJfprDB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

hi there,

i think the following should be changed. with
kern.threads.max_threads_per_proc=N, a process should be able to maintain
N threads and not N-1.

to verify simply use tools/test/pthread_vfork.

cheers.
alex

-- 
a13x

--DocE+STaALJfprDB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="kern_thr.c.diff"

diff --git a/sys/kern/kern_thr.c b/sys/kern/kern_thr.c
index 75656f0..63bf1bc 100644
--- a/sys/kern/kern_thr.c
+++ b/sys/kern/kern_thr.c
@@ -153,7 +153,7 @@ create_thread(struct thread *td, mcontext_t *ctx,
 	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);
 	}

--DocE+STaALJfprDB--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110223111648.GA41592>