Date: Fri, 29 Nov 2013 23:46:04 -0700 From: "Justin T. Gibbs" <gibbs@scsiguy.com> To: Andriy Gapon <avg@FreeBSD.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r258713 - in head/sys: kern sys Message-ID: <3784C560-3648-4E03-93DA-9A60E3AC401D@scsiguy.com> In-Reply-To: <201311281856.rASIuZu8059699@svn.freebsd.org> References: <201311281856.rASIuZu8059699@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Man page update? =97 Justin On Nov 28, 2013, at 11:56 AM, Andriy Gapon <avg@FreeBSD.org> wrote: > Author: avg > Date: Thu Nov 28 18:56:34 2013 > New Revision: 258713 > URL: http://svnweb.freebsd.org/changeset/base/258713 >=20 > Log: > add taskqueue_drain_all >=20 > This API has semantics similar to that of taskqueue_drain but acts on > all tasks that might be queued or running on a taskqueue. > A caller must ensure that no new tasks are being enqueued otherwise = this > call would be totally meaningless. For example, if the tasks are > enqueued by an interrupt filter then its interrupt must be disabled. >=20 > MFC after: 10 days >=20 > Modified: > head/sys/kern/subr_taskqueue.c > head/sys/sys/taskqueue.h >=20 > 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 Thu Nov 28 16:36:03 2013 = (r258712) > +++ head/sys/kern/subr_taskqueue.c Thu Nov 28 18:56:34 2013 = (r258713) > @@ -300,6 +300,15 @@ taskqueue_enqueue_timeout(struct taskque > return (res); > } >=20 > +static void > +taskqueue_drain_running(struct taskqueue *queue) > +{ > + > + while (!TAILQ_EMPTY(&queue->tq_active)) > + TQ_SLEEP(queue, &queue->tq_active, &queue->tq_mutex, > + PWAIT, "-", 0); > +} > + > void > taskqueue_block(struct taskqueue *queue) > { > @@ -350,6 +359,8 @@ taskqueue_run_locked(struct taskqueue *q > wakeup(task); > } > TAILQ_REMOVE(&queue->tq_active, &tb, tb_link); > + if (TAILQ_EMPTY(&queue->tq_active)) > + wakeup(&queue->tq_active); > } >=20 > void > @@ -434,6 +445,25 @@ taskqueue_drain(struct taskqueue *queue, > } >=20 > void > +taskqueue_drain_all(struct taskqueue *queue) > +{ > + struct task *task; > + > + if (!queue->tq_spin) > + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, = __func__); > + > + TQ_LOCK(queue); > + task =3D STAILQ_LAST(&queue->tq_queue, task, ta_link); > + if (task !=3D NULL) > + while (task->ta_pending !=3D 0) > + TQ_SLEEP(queue, task, &queue->tq_mutex, PWAIT, = "-", 0); > + taskqueue_drain_running(queue); > + KASSERT(STAILQ_EMPTY(&queue->tq_queue), > + ("taskqueue queue is not empty after draining")); > + TQ_UNLOCK(queue); > +} > + > +void > taskqueue_drain_timeout(struct taskqueue *queue, > struct timeout_task *timeout_task) > { >=20 > Modified: head/sys/sys/taskqueue.h > = =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/sys/taskqueue.h Thu Nov 28 16:36:03 2013 = (r258712) > +++ head/sys/sys/taskqueue.h Thu Nov 28 18:56:34 2013 = (r258713) > @@ -81,6 +81,7 @@ int taskqueue_cancel_timeout(struct task > void taskqueue_drain(struct taskqueue *queue, struct task *task); > void taskqueue_drain_timeout(struct taskqueue *queue, > struct timeout_task *timeout_task); > +void taskqueue_drain_all(struct taskqueue *queue); > void taskqueue_free(struct taskqueue *queue); > void taskqueue_run(struct taskqueue *queue); > void taskqueue_block(struct taskqueue *queue); >=20
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3784C560-3648-4E03-93DA-9A60E3AC401D>