nvmf/tcp: In _pdu_write_done, free pdu before calling user callback
By releasing the just-completed PDU prior to calling the callback, for flows that immediately submit another PDU inside the callback, the just-released PDU can be immediately reused. This reduces the number of PDUs required in the pool to continue forward progress to half of the previous value, while also making it more CPU cache friendly. Change-Id: I8031b8f9f57ac05f261d96433d9899fe5e31d318 Signed-off-by: Ben Walker <benjamin.walker@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479904 Community-CI: SPDK CI Jenkins <sys_sgci@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ziye Yang <ziye.yang@intel.com> Reviewed-by: Or Gerlitz <gerlitz.or@gmail.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
931ac757fb
commit
5a7b33ec67
@ -764,10 +764,12 @@ spdk_nvmf_tcp_qpair_disconnect(struct spdk_nvmf_tcp_qpair *tqpair)
|
||||
}
|
||||
|
||||
static void
|
||||
_pdu_write_done(void *cb_arg, int err)
|
||||
_pdu_write_done(void *_pdu, int err)
|
||||
{
|
||||
struct nvme_tcp_pdu *pdu = cb_arg;
|
||||
struct spdk_nvmf_tcp_qpair *tqpair = pdu->qpair;
|
||||
struct nvme_tcp_pdu *pdu = _pdu;
|
||||
struct spdk_nvmf_tcp_qpair *tqpair = pdu->qpair;
|
||||
nvme_tcp_qpair_xfer_complete_cb cb_fn;
|
||||
void *cb_arg;
|
||||
|
||||
TAILQ_REMOVE(&tqpair->send_queue, pdu, tailq);
|
||||
|
||||
@ -783,9 +785,15 @@ _pdu_write_done(void *cb_arg, int err)
|
||||
}
|
||||
|
||||
assert(pdu->cb_fn != NULL);
|
||||
pdu->cb_fn(pdu->cb_arg);
|
||||
|
||||
/* Capture the callback and argument so we can free the PDU
|
||||
* prior to calling the callback. */
|
||||
cb_fn = pdu->cb_fn;
|
||||
cb_arg = pdu->cb_arg;
|
||||
|
||||
spdk_nvmf_tcp_pdu_put(tqpair, pdu);
|
||||
|
||||
cb_fn(cb_arg);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user