From owner-svn-src-all@FreeBSD.ORG Sat Nov 30 07:31:18 2013 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2426EC5B; Sat, 30 Nov 2013 07:31:18 +0000 (UTC) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id E66D610FB; Sat, 30 Nov 2013 07:31:16 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id JAA26895; Sat, 30 Nov 2013 09:31:06 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1Vmf17-000J6u-2Q; Sat, 30 Nov 2013 09:31:05 +0200 Message-ID: <52999401.5010306@FreeBSD.org> Date: Sat, 30 Nov 2013 09:30:09 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: "Justin T. Gibbs" Subject: Re: svn commit: r258713 - in head/sys: kern sys References: <201311281856.rASIuZu8059699@svn.freebsd.org> <3784C560-3648-4E03-93DA-9A60E3AC401D@scsiguy.com> In-Reply-To: <3784C560-3648-4E03-93DA-9A60E3AC401D@scsiguy.com> X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Nov 2013 07:31:18 -0000 on 30/11/2013 08:46 Justin T. Gibbs said the following: > Man page update? Yes, coming. > On Nov 28, 2013, at 11:56 AM, Andriy Gapon wrote: > >> Author: avg >> Date: Thu Nov 28 18:56:34 2013 >> New Revision: 258713 >> URL: http://svnweb.freebsd.org/changeset/base/258713 >> >> Log: >> add taskqueue_drain_all >> >> 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. >> >> MFC after: 10 days >> >> Modified: >> head/sys/kern/subr_taskqueue.c >> head/sys/sys/taskqueue.h >> >> Modified: head/sys/kern/subr_taskqueue.c >> ============================================================================== >> --- 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); >> } >> >> +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); >> } >> >> void >> @@ -434,6 +445,25 @@ taskqueue_drain(struct taskqueue *queue, >> } >> >> 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 = STAILQ_LAST(&queue->tq_queue, task, ta_link); >> + if (task != NULL) >> + while (task->ta_pending != 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) >> { >> >> Modified: head/sys/sys/taskqueue.h >> ============================================================================== >> --- 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); >> > -- Andriy Gapon