Date: Fri, 12 Nov 2010 10:06:10 +0100 From: Hans Petter Selasky <hselasky@c2i.net> To: freebsd-current@freebsd.org Cc: Matthew Fleming <matthew.fleming@isilon.com> Subject: Re: sleep bug in taskqueue(9) Message-ID: <201011121006.10183.hselasky@c2i.net> In-Reply-To: <06D5F9F6F655AD4C92E28B662F7F853E039E389A@seaxch09.desktop.isilon.com> References: <06D5F9F6F655AD4C92E28B662F7F853E039E389A@seaxch09.desktop.isilon.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday 29 April 2010 01:59:58 Matthew Fleming wrote:
> struct task {
> - STAILQ_ENTRY(task) ta_link; /* link for queue */
> - u_short ta_pending; /* count times queued */
> - u_short ta_priority; /* Priority */
> - task_fn_t *ta_func; /* task handler */
> - void *ta_context; /* argument for handler */
> + STAILQ_ENTRY(task) ta_link; /* (q) link for queue */
> + u_char ta_flags; /* (q) state of this task */
> +#define TA_FLAGS_RUNNING 0x01
> + u_short ta_pending; /* (q) count times queued */
> + u_short ta_priority; /* (c) Priority */
> + task_fn_t *ta_func; /* (c) task handler */
> + void *ta_context; /* (c) argument for handler */
Hi,
I would rather implement TAILQ_ENTRY() here, and put some magic in the
"tqe_prev" field, hence the u_char you add, will be padded to a bigger size on
non-intel platforms anyway.
task->ta_pending = 0;
- queue->tq_running = task;
+ task->ta_entry.tqe_prev = (void *)1;
TQ_UNLOCK(queue);
task->ta_func(task->ta_context, pending);
TQ_LOCK(queue);
- queue->tq_running = NULL;
+ task->ta_entry.tqe_prev = (void *)0;
wakeup(task);
}
...
+ while (task->ta_entry != (void *)0)
--HPS
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201011121006.10183.hselasky>
