Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 May 2000 12:35:46 -0500
From:      "C. Stephen Gunn" <csg@waterspout.com>
To:        Doug Rabson <dfr@nlsystems.com>
Cc:        arch@FreeBSD.ORG
Subject:   Re: A new api for asynchronous task execution (3)
Message-ID:  <20000521123546.A7522@waterspout.com>
In-Reply-To: <Pine.BSF.4.21.0005182120520.73457-400000@salmon.nlsystems.com>; from dfr@nlsystems.com on Thu, May 18, 2000 at 09:24:13PM %2B0100
References:  <Pine.BSF.4.21.0005182120520.73457-400000@salmon.nlsystems.com>

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

Doug & -arch,

First let me say that your taskqueue stuff looks great.  In looking
over the API, and your implementation, I have some questions.

First, as someone else already pointed out, you were calling the
tasks at splhigh().  While you fixed this in taskqueue_run(), the
call to taskqueue_run() inside taskqueue_free() runs at splhigh().
This is probably intended to avoid new tasks being queued by
interrupt handlers while disposing of the queue.

What about an intelligent (or stupid) task that tries to queue
itself onto the queue again?  This isn't an uncommon mechanism for
periodic tasks.

Having taskqueue_enqueue() return an error if we're in the process
of deleting this queue could address this problem.  It's a rare
case, since I don't foresee the creation/deletion of queues happening
with much frequency.

I was also wondering about the ta_context mechanism.  I initially
thought you were trying to hide the task structure behind the API
so that binary-only modules (and the like) would be tolerant of
changes in the structure.  This is probably not the case, since
task_enqueue() takes a struct *task.

Would there be any benefit to simply passing the task structure to
the task_fn()?

Tasks could then define a struct with a struct task at the top.
This mechanism is certainly used lots of placed in the kernel.
I know there's little real difference.  I guess my questions is
whether the rest of the kernel sets any precident.

Next, I was wondering if it made any sense to put a pointer to the
taskqueue in the task structure.  This would make it easier for
a task_fn() to re-queue itself.  Or should we doucment that
practice as inappropriate.

Finally, are you planning to call taskqueue_free() on all the queues
at system shutdown?  This is obviously outside the scope of the
code you'd provided, I was just wondering.

 - Steve


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




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