diff options
author | Ben Pfaff <blp@nicira.com> | 2010-05-12 10:56:45 -0700 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2010-05-26 11:46:59 -0700 |
commit | 8bf4bbe390af3f370e7e95d9237572ff750047a8 (patch) | |
tree | edb5dd1c4a748f2f8398d186f13657e3182e922c /ovsdb/trigger.c | |
parent | 3c442619836797b78bbb3472385a4982582cb907 (diff) | |
download | openvswitch-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.c | 4 |
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); } } } |