remove front-push related code

Now that only the top thread delivers, we can remove the
support for multiple unpending and delivering threads.
parent ed188cf7
......@@ -885,17 +885,6 @@ worklist_set_delivered(struct vdp_ctx *vdx, struct bytes_tree *tree,
}
}
/*
* to minimize lock contention, we walk the tree and gather work on a list
*/
#define set_front(tree, node, wrk) do { \
(tree)->front = node; \
(tree)->front_owner = wrk; \
} while(0)
#define set_end(tree, node) (tree)->end = node;
static void
worklist_unpend(const struct vdp_ctx *vdx, struct bytes_tree *tree,
struct node_head *work)
......@@ -926,12 +915,8 @@ worklist_unpend(const struct vdp_ctx *vdx, struct bytes_tree *tree,
return;
}
AN(tree->front);
if (tree->front_owner == vdx->wrk)
node = tree->front;
else
node = tree->root;
node = tree->front;
AN(node);
/* when starting, we do not want to see any ST_UNPENDING nodes */
check = CHK_DELI;
......@@ -966,7 +951,7 @@ worklist_unpend(const struct vdp_ctx *vdx, struct bytes_tree *tree,
continue;
VSLdbg(vdx, "bytes_unpend: reached root");
set_front(tree, tree->root, vdx->wrk);
tree->front = tree->root;
if (tree->end != NULL)
tree->end->is_end = 1;
return;
......@@ -976,7 +961,7 @@ worklist_unpend(const struct vdp_ctx *vdx, struct bytes_tree *tree,
VSLdbgv(vdx, "bytes_unpend: return at "
"node %p state %u - private",
node, node->state);
set_front(tree, node, vdx->wrk);
tree->front = node;
return;
}
......@@ -996,15 +981,13 @@ worklist_unpend(const struct vdp_ctx *vdx, struct bytes_tree *tree,
VSTAILQ_INSERT_TAIL(work, node, unpend);
set_unpending(tree, node);
set_end(tree, node);
tree->end = node;
// for more iterations, also accept UNPEND
// for now, we use any
check = CHK_ANY;
}
}
#undef set_front
void
tree_deliver(struct vdp_ctx *vdx, struct bytes_tree *tree)
{
......@@ -1014,17 +997,10 @@ tree_deliver(struct vdp_ctx *vdx, struct bytes_tree *tree)
CHECK_OBJ_NOTNULL(vdx, VDP_CTX_MAGIC);
CHECK_OBJ_NOTNULL(vdx->wrk, WORKER_MAGIC);
if (tree->unpend_owner != NULL)
return;
tree->unpend_owner = vdx->wrk;
/*lint -e{506} constant value boolean */
do {
Lck_AssertHeld(&tree->tree_lock);
assert(tree->unpend_owner == vdx->wrk);
VSTAILQ_INIT(&work);
worklist_unpend(vdx, tree, &work);
......@@ -1041,6 +1017,4 @@ tree_deliver(struct vdp_ctx *vdx, struct bytes_tree *tree)
}
worklist_set_delivered(vdx, tree, &work);
} while (1);
tree->unpend_owner = NULL;
}
......@@ -42,8 +42,6 @@ struct bytes_tree {
pthread_cond_t cond;
struct node *root;
struct node *front;
const struct worker *front_owner;
const struct worker *unpend_owner;
// candidate for last ever node
struct node *end;
int end_sent;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment