From 6550abbac16f7bb4aea326638a062c59cd96f801 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Mon, 3 Jun 2019 04:10:07 -0700 Subject: [PATCH] nvme: prefetch stailq before freeing pcie request We will need to put the recently completed nvme_request object on the qpair's STAILQ. We don't reference any real data from the nvme_request in the completion path since we've already stashed the cb_fn and cb_arg in the nvme_tracker. But we will need to reference the STAILQ_ENTRY to put it back in the qpair's STAILQ, so prefetch that cacheline. Signed-off-by: Jim Harris Change-Id: Id76122afe4150c84a61fbe38bc874f10d606b3b3 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456673 Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Shuhei Matsumoto --- lib/nvme/nvme_pcie.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/nvme/nvme_pcie.c b/lib/nvme/nvme_pcie.c index 976e4b73c..c5967605a 100644 --- a/lib/nvme/nvme_pcie.c +++ b/lib/nvme/nvme_pcie.c @@ -2094,6 +2094,10 @@ nvme_pcie_qpair_process_completions(struct spdk_nvme_qpair *qpair, uint32_t max_ } tr = &pqpair->tr[cpl->cid]; + /* Prefetch the req's STAILQ_ENTRY since we'll need to access it + * as part of putting the req back on the qpair's free list. + */ + __builtin_prefetch(&tr->req->stailq); pqpair->sq_head = cpl->sqhd; if (tr->req) {