NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/55948: threadpool_job_cancelthrash test randomly fails



The following reply was made to PR kern/55948; it has been noted by GNATS.

From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: netbsd-bugs%NetBSD.org@localhost, gson%gson.org@localhost, chs%NetBSD.org@localhost
Subject: Re: kern/55948: threadpool_job_cancelthrash test randomly fails
Date: Sat, 23 Jan 2021 15:41:42 +0000

 This is a multi-part message in MIME format.
 --=_AOwXQ/EBfoe4E3bC1VjlNXMqYcZsjEER
 
 Try the attached patch?
 
 --=_AOwXQ/EBfoe4E3bC1VjlNXMqYcZsjEER
 Content-Type: text/plain; charset="ISO-8859-1"; name="threadpool"
 Content-Transfer-Encoding: quoted-printable
 Content-Disposition: attachment; filename="threadpool.patch"
 
 diff -r 859d0e5ac5a2 sys/kern/kern_threadpool.c
 --- a/sys/kern/kern_threadpool.c	Sun Jan 17 22:02:46 2021 +0000
 +++ b/sys/kern/kern_threadpool.c	Sat Jan 23 15:40:39 2021 +0000
 @@ -1041,7 +1041,7 @@ threadpool_dispatcher_thread(void *arg)
 =20
  		/* There are idle threads, so try giving one a job.  */
  		struct threadpool_job *const job =3D TAILQ_FIRST(&pool->tp_jobs);
 -		TAILQ_REMOVE(&pool->tp_jobs, job, job_entry);
 +
  		/*
  		 * Take an extra reference on the job temporarily so that
  		 * it won't disappear on us while we have both locks dropped.
 @@ -1053,6 +1053,7 @@ threadpool_dispatcher_thread(void *arg)
  		/* If the job was cancelled, we'll no longer be its thread.  */
  		if (__predict_true(job->job_thread =3D=3D dispatcher)) {
  			mutex_spin_enter(&pool->tp_lock);
 +			TAILQ_REMOVE(&pool->tp_jobs, job, job_entry);
  			if (__predict_false(
  				    TAILQ_EMPTY(&pool->tp_idle_threads))) {
  				/*
 
 --=_AOwXQ/EBfoe4E3bC1VjlNXMqYcZsjEER--
 


Home | Main Index | Thread Index | Old Index