vswitchd: Disable system stats collection on a concurrently running daemon.
authorGurucharan Shetty <gshetty@nicira.com>
Sun, 28 Apr 2013 02:58:12 +0000 (19:58 -0700)
committerGurucharan Shetty <gshetty@nicira.com>
Mon, 29 Apr 2013 22:09:48 +0000 (15:09 -0700)
commit9f27568d9f6615b486bd13324b9a607864ef8780
tree3b09b32d3c68a6485d0feeec0b37e7c3f42acd28
parent488232b7ec7921753ec27ffd836a51f23afae0b8
vswitchd: Disable system stats collection on a concurrently running daemon.

There are very rare cases (ex: ovs-vswitchd.pid is inadvertantly deleted),
when multiple ovs-vswitchd daemons can end up running at the same time.
In a situation like that one of the daemons can wait on the poll()
with a 0 ms wait time as it would be expecting system stats to be collected.

But system stats are never run for the daemon that does not have the
lock on the database and hence it takes up 100% of the CPU if its state
machine for stats collection previously was S_WAITING.

With this patch, we disable the system stats collection for the daemon that
does not have the database lock. When it eventually gets the lock on the
database, system stats are automatically enabled if other_config:\
enable-statistics=true.

Bug #16669.
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
vswitchd/bridge.c