On 18/02/2015 12:57, Pavel Dovgalyuk wrote: > + QSIMPLEQ_FOREACH_SAFE(bh, &ctx->bh_queue, next, next) { > if (bh->deleted) { > - *bhp = bh->next; > + QSIMPLEQ_REMOVE(&ctx->bh_queue, bh, QEMUBH, next);
QSIMPLEQ_REMOVE is very inefficient, so that this loop can become O(n^2). You could use QTAILQ or introduce QSIMPLE_REMOVE_AFTER. Paolo > g_free(bh); > - } else { > - bhp = &bh->next; > }