[PATCH 14/29v2] Optimize canceling a MAD

From: Hal Rosenstock
Date: Mon Jul 11 2005 - 18:58:42 EST


Optimize canceling a MAD.
- Eliminate searching timeout list in cancel case.
- Remove duplicate calls to queue work item.
- Eliminate resending a MAD before MAD is completed.

Signed-off-by: Sean Hefty <sean.hefty@xxxxxxxxx>
Signed-off-by: Hal Rosenstock <halr@xxxxxxxxxxxx>

This patch depends on patch 13/29.

--
mad.c | 21 +++++++++++++--
1 files changed, 13 insertions(+), 8 deletions(-)
diff -uprN linux-2.6.13-rc2-mm1-13/drivers/infiniband/core/mad.c linux-2.6.13-rc2-mm1-14/drivers/infiniband/core/mad.c
-- linux-2.6.13-rc2-mm1-13/drivers/infiniband/core/mad.c 2005-07-11 13:38:30.000000000 -0400
+++ linux-2.6.13-rc2-mm1-14/drivers/infiniband/core/mad.c 2005-07-11 13:38:42.000000000 -0400
@@ -1754,14 +1754,18 @@ static void wait_for_response(struct ib_
delay = mad_send_wr->timeout;
mad_send_wr->timeout += jiffies;

- list_for_each_prev(list_item, &mad_agent_priv->wait_list) {
- temp_mad_send_wr = list_entry(list_item,
- struct ib_mad_send_wr_private,
- agent_list);
- if (time_after(mad_send_wr->timeout,
- temp_mad_send_wr->timeout))
- break;
+ if (delay) {
+ list_for_each_prev(list_item, &mad_agent_priv->wait_list) {
+ temp_mad_send_wr = list_entry(list_item,
+ struct ib_mad_send_wr_private,
+ agent_list);
+ if (time_after(mad_send_wr->timeout,
+ temp_mad_send_wr->timeout))
+ break;
+ }
}
+ else
+ list_item = &mad_agent_priv->wait_list;
list_add(&mad_send_wr->agent_list, list_item);

/* Reschedule a work item if we have a shorter timeout */
@@ -2197,7 +2201,8 @@ static void timeout_sends(void *data)
}

list_del(&mad_send_wr->agent_list);
- if (!retry_send(mad_send_wr))
+ if (mad_send_wr->status == IB_WC_SUCCESS &&
+ !retry_send(mad_send_wr))
continue;

spin_unlock_irqrestore(&mad_agent_priv->lock, flags);


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/