Skip to content

Commit f56cbbb

Browse files
author
Nicholas Bellinger
committed
iscsi-target: Perform release of acknowledged tags from RX context
This patch converts iscsit_ack_from_expstatsn() to populate a local ack_list of commands, and call iscsit_free_cmd() directly from RX thread context, instead of using iscsit_add_cmd_to_immediate_queue() to queue the acknowledged commands to be released from TX thread context. It is helpful to release the acknowledge commands as quickly as possible, along with the associated percpu_ida tags, in order to prevent percpu_ida_alloc() from having to steal tags from other CPUs while waiting for iscsit_free_cmd() to happen from TX thread context. Signed-off-by: Nicholas Bellinger <[email protected]>
1 parent e255a28 commit f56cbbb

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

drivers/target/iscsi/iscsi_target.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -753,27 +753,32 @@ static void iscsit_unmap_iovec(struct iscsi_cmd *cmd)
753753

754754
static void iscsit_ack_from_expstatsn(struct iscsi_conn *conn, u32 exp_statsn)
755755
{
756-
struct iscsi_cmd *cmd;
756+
LIST_HEAD(ack_list);
757+
struct iscsi_cmd *cmd, *cmd_p;
757758

758759
conn->exp_statsn = exp_statsn;
759760

760761
if (conn->sess->sess_ops->RDMAExtensions)
761762
return;
762763

763764
spin_lock_bh(&conn->cmd_lock);
764-
list_for_each_entry(cmd, &conn->conn_cmd_list, i_conn_node) {
765+
list_for_each_entry_safe(cmd, cmd_p, &conn->conn_cmd_list, i_conn_node) {
765766
spin_lock(&cmd->istate_lock);
766767
if ((cmd->i_state == ISTATE_SENT_STATUS) &&
767768
iscsi_sna_lt(cmd->stat_sn, exp_statsn)) {
768769
cmd->i_state = ISTATE_REMOVE;
769770
spin_unlock(&cmd->istate_lock);
770-
iscsit_add_cmd_to_immediate_queue(cmd, conn,
771-
cmd->i_state);
771+
list_move_tail(&cmd->i_conn_node, &ack_list);
772772
continue;
773773
}
774774
spin_unlock(&cmd->istate_lock);
775775
}
776776
spin_unlock_bh(&conn->cmd_lock);
777+
778+
list_for_each_entry_safe(cmd, cmd_p, &ack_list, i_conn_node) {
779+
list_del(&cmd->i_conn_node);
780+
iscsit_free_cmd(cmd, false);
781+
}
777782
}
778783

779784
static int iscsit_allocate_iovecs(struct iscsi_cmd *cmd)

0 commit comments

Comments
 (0)