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, ...@@ -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 static void
worklist_unpend(const struct vdp_ctx *vdx, struct bytes_tree *tree, worklist_unpend(const struct vdp_ctx *vdx, struct bytes_tree *tree,
struct node_head *work) struct node_head *work)
...@@ -926,12 +915,8 @@ worklist_unpend(const struct vdp_ctx *vdx, struct bytes_tree *tree, ...@@ -926,12 +915,8 @@ worklist_unpend(const struct vdp_ctx *vdx, struct bytes_tree *tree,
return; return;
} }
AN(tree->front); node = tree->front;
AN(node);
if (tree->front_owner == vdx->wrk)
node = tree->front;
else
node = tree->root;
/* when starting, we do not want to see any ST_UNPENDING nodes */ /* when starting, we do not want to see any ST_UNPENDING nodes */
check = CHK_DELI; check = CHK_DELI;
...@@ -966,7 +951,7 @@ worklist_unpend(const struct vdp_ctx *vdx, struct bytes_tree *tree, ...@@ -966,7 +951,7 @@ worklist_unpend(const struct vdp_ctx *vdx, struct bytes_tree *tree,
continue; continue;
VSLdbg(vdx, "bytes_unpend: reached root"); VSLdbg(vdx, "bytes_unpend: reached root");
set_front(tree, tree->root, vdx->wrk); tree->front = tree->root;
if (tree->end != NULL) if (tree->end != NULL)
tree->end->is_end = 1; tree->end->is_end = 1;
return; return;
...@@ -976,7 +961,7 @@ worklist_unpend(const struct vdp_ctx *vdx, struct bytes_tree *tree, ...@@ -976,7 +961,7 @@ worklist_unpend(const struct vdp_ctx *vdx, struct bytes_tree *tree,
VSLdbgv(vdx, "bytes_unpend: return at " VSLdbgv(vdx, "bytes_unpend: return at "
"node %p state %u - private", "node %p state %u - private",
node, node->state); node, node->state);
set_front(tree, node, vdx->wrk); tree->front = node;
return; return;
} }
...@@ -996,15 +981,13 @@ worklist_unpend(const struct vdp_ctx *vdx, struct bytes_tree *tree, ...@@ -996,15 +981,13 @@ worklist_unpend(const struct vdp_ctx *vdx, struct bytes_tree *tree,
VSTAILQ_INSERT_TAIL(work, node, unpend); VSTAILQ_INSERT_TAIL(work, node, unpend);
set_unpending(tree, node); set_unpending(tree, node);
set_end(tree, node); tree->end = node;
// for more iterations, also accept UNPEND // for more iterations, also accept UNPEND
// for now, we use any // for now, we use any
check = CHK_ANY; check = CHK_ANY;
} }
} }
#undef set_front
void void
tree_deliver(struct vdp_ctx *vdx, struct bytes_tree *tree) tree_deliver(struct vdp_ctx *vdx, struct bytes_tree *tree)
{ {
...@@ -1014,17 +997,10 @@ 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, VDP_CTX_MAGIC);
CHECK_OBJ_NOTNULL(vdx->wrk, WORKER_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 */ /*lint -e{506} constant value boolean */
do { do {
Lck_AssertHeld(&tree->tree_lock); Lck_AssertHeld(&tree->tree_lock);
assert(tree->unpend_owner == vdx->wrk);
VSTAILQ_INIT(&work); VSTAILQ_INIT(&work);
worklist_unpend(vdx, tree, &work); worklist_unpend(vdx, tree, &work);
...@@ -1041,6 +1017,4 @@ tree_deliver(struct vdp_ctx *vdx, struct bytes_tree *tree) ...@@ -1041,6 +1017,4 @@ tree_deliver(struct vdp_ctx *vdx, struct bytes_tree *tree)
} }
worklist_set_delivered(vdx, tree, &work); worklist_set_delivered(vdx, tree, &work);
} while (1); } while (1);
tree->unpend_owner = NULL;
} }
...@@ -42,8 +42,6 @@ struct bytes_tree { ...@@ -42,8 +42,6 @@ struct bytes_tree {
pthread_cond_t cond; pthread_cond_t cond;
struct node *root; struct node *root;
struct node *front; struct node *front;
const struct worker *front_owner;
const struct worker *unpend_owner;
// candidate for last ever node // candidate for last ever node
struct node *end; struct node *end;
int end_sent; 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