Date: Fri, 13 Aug 2010 12:47:11 -0700 From: mdf@FreeBSD.org To: Pawel Jakub Dawidek <pjd@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211284 - head/sys/kern Message-ID: <AANLkTinVPX0buiA4aS2UvYu%2BYRn0G9FTACK=9RvQMksk@mail.gmail.com> In-Reply-To: <201008131920.o7DJKZgD004713@svn.freebsd.org> References: <201008131920.o7DJKZgD004713@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Aug 13, 2010 at 12:20 PM, Pawel Jakub Dawidek <pjd@freebsd.org> wro= te: > Author: pjd > Date: Fri Aug 13 19:20:35 2010 > New Revision: 211284 > URL: http://svn.freebsd.org/changeset/base/211284 > > Log: > =A0Simplify taskqueue_drain() by using proved macros. Thanks! This was on my to-do list since I'd been in this file, once I could figure out why it hand't already been done. :-) Cheers, matthew > > Modified: > =A0head/sys/kern/subr_taskqueue.c > > Modified: head/sys/kern/subr_taskqueue.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/kern/subr_taskqueue.c =A0 =A0 =A0Fri Aug 13 18:17:32 2010 = =A0 =A0 =A0 =A0(r211283) > +++ head/sys/kern/subr_taskqueue.c =A0 =A0 =A0Fri Aug 13 19:20:35 2010 = =A0 =A0 =A0 =A0(r211284) > @@ -248,23 +248,16 @@ taskqueue_run(struct taskqueue *queue, s > =A0void > =A0taskqueue_drain(struct taskqueue *queue, struct task *task) > =A0{ > - =A0 =A0 =A0 if (queue->tq_spin) { =A0 =A0 =A0 =A0 =A0 /* XXX */ > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 mtx_lock_spin(&queue->tq_mutex); > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 while (task->ta_pending !=3D 0 || > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (task->ta_running !=3D NULL && task= =3D=3D *task->ta_running)) { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 msleep_spin(task, &queue->t= q_mutex, "-", 0); > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 mtx_unlock_spin(&queue->tq_mutex); > - =A0 =A0 =A0 } else { > + > + =A0 =A0 =A0 if (!queue->tq_spin) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, = NULL, __func__); > > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 mtx_lock(&queue->tq_mutex); > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 while (task->ta_pending !=3D 0 || > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (task->ta_running !=3D NULL && task= =3D=3D *task->ta_running)) { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 msleep(task, &queue->tq_mut= ex, PWAIT, "-", 0); > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 mtx_unlock(&queue->tq_mutex); > + =A0 =A0 =A0 TQ_LOCK(queue); > + =A0 =A0 =A0 while (task->ta_pending !=3D 0 || > + =A0 =A0 =A0 =A0 =A0 (task->ta_running !=3D NULL && task =3D=3D *task->t= a_running)) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 TQ_SLEEP(queue, task, &queue->tq_mutex, PWA= IT, "-", 0); > =A0 =A0 =A0 =A0} > + =A0 =A0 =A0 TQ_UNLOCK(queue); > =A0} > > =A0static void >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTinVPX0buiA4aS2UvYu%2BYRn0G9FTACK=9RvQMksk>