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 /lib/learning-switch.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 'lib/learning-switch.c')
| -rw-r--r-- | lib/learning-switch.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/lib/learning-switch.c b/lib/learning-switch.c index 126cc6b89..91f8f0527 100644 --- a/lib/learning-switch.c +++ b/lib/learning-switch.c @@ -221,12 +221,7 @@ static void wait_timeout(long long int started) { long long int now = time_msec(); - long long int timeout = 10000 - (now - started); - if (timeout <= 0) { - poll_immediate_wake(); - } else { - poll_timer_wait(timeout); - } + poll_timer_wait(10000 - (now - started)); } void |
