[openib-general] [PATCH] Use time_after_eq() instead of time_after() in queue_req()

Krishna Kumar krkumar2 at in.ibm.com
Mon Oct 16 21:39:09 PDT 2006


In queue_req(), use time_after_eq() instead of time_after()
for following reasons :

- Improves insert time if multiple entries with same time are
  present.
- set_timeout need not be called if entry with same time
  is added to the list (and that happens to be the entry
  with the smallest time), saving atomic/locking operations.
- Earlier entries with same time are deleted first (fifo).

Signed-off-by: Krishna Kumar <krkumar2 at in.ibm.com>
--------
diff -ruNp org/drivers/infiniband/core/addr.c new/drivers/infiniband/core/addr.c
--- org/drivers/infiniband/core/addr.c	2006-10-09 16:54:37.000000000 +0530
+++ new/drivers/infiniband/core/addr.c	2006-10-09 16:55:36.000000000 +0530
@@ -118,7 +118,7 @@ static void queue_req(struct addr_req *r
 
 	mutex_lock(&lock);
 	list_for_each_entry_reverse(temp_req, &req_list, list) {
-		if (time_after(req->timeout, temp_req->timeout))
+		if (time_after_eq(req->timeout, temp_req->timeout))
 			break;
 	}




More information about the general mailing list