summaryrefslogtreecommitdiff
path: root/ovsdb/trigger.c
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2010-05-12 10:56:45 -0700
committerBen Pfaff <blp@nicira.com>2010-05-26 11:46:59 -0700
commit8bf4bbe390af3f370e7e95d9237572ff750047a8 (patch)
treeedb5dd1c4a748f2f8398d186f13657e3182e922c /ovsdb/trigger.c
parent3c442619836797b78bbb3472385a4982582cb907 (diff)
downloadopenvswitch-8bf4bbe390af3f370e7e95d9237572ff750047a8.tar.gz
poll-loop: Change poll_timer_wait() parameter from "int" to "long long".
Every so often I get concerned because OVS does most of its time arithmetic in "long long int" but poll_timer_wait() takes an "int", so there is potential for truncating a large value to a small value or a positive value to a negative value. That would cause excessive wakeups and possibly 100% CPU usage. This commit therefore changes poll_timer_wait()'s parameter type from "int" to "long long int". The file-scope 'timeout' variable remains type "int" because that is the type of poll()'s timeout argument. Factoring poll_timer_wait() into two functions is not necessary here but it comes in handy in the following patch.
Diffstat (limited to 'ovsdb/trigger.c')
-rw-r--r--ovsdb/trigger.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ovsdb/trigger.c b/ovsdb/trigger.c
index 1ecfdcac1..8f18291f4 100644
--- a/ovsdb/trigger.c
+++ b/ovsdb/trigger.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009 Nicira Networks
+/* Copyright (c) 2009, 2010 Nicira Networks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -102,7 +102,7 @@ ovsdb_trigger_wait(struct ovsdb *db, long long int now)
}
if (deadline < LLONG_MAX) {
- poll_timer_wait(MIN(deadline - now, INT_MAX));
+ poll_timer_wait(deadline - now);
}
}
}