Hi,
On Saturday 06 November 2010 14:57:50 Matthew Fleming wrote:
I agree that the order of checks is not important. That is not the problem.
Cut & paste from suggested taskqueue patch from Fleming:
> +int
What happens in this case if ta_pending > 0. Are you saying this is not
possible? If ta_pending > 0, shouldn't we also do a STAILQ_REMOVE() ?
Agreed, but that is not what I'm pointing at. I'm pointing at what happens if
you re-queue a task and then cancel while it is actually running. Will the
task still be queued for execution after taskqueue_cancel()?
This is not the problem.
And if you re-queue and cancel in this window, shouldn't this also be handled
like in the other cases?
Cut & paste from kern/subr_taskqueue.c:
task->ta_pending = 0;
tb.tb_running = task;
TQ_UNLOCK(queue);
If a concurrent thread at exactly this point in time calls taskqueue_enqueue()
on this task, then we re-add the task to the "queue->tq_queue". So far we
agree. Imagine now that for some reason a following call to taskqueue_cancel()
on this task at same point in time. Now, shouldn't taskqueue_cancel() also
remove the task from the "queue->tq_queue" in this case aswell? Because in
your implementation you only remove the task if we are not running, and that
is not true when we are at exactly this point in time.
task->ta_func(task->ta_context, pending);
TQ_LOCK(queue);
tb.tb_running = NULL;
wakeup(task);
Another issue I noticed is that the ta_pending counter should have a wrap
protector.
--HPS
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"