Previously, we iterated through all interfaces in instant_stats_run(), grabbing up-to-date information about device status. After assembling all of this information for all interfaces, we would determine whether anything changed and only send an update to ovsdb-server if something changed.
This patch uses the new global netdev_seq to determine whether there have been any changes before polling all interfaces, which provides further CPU usage savings. In a test environment of 5000 internal ports and 50 tunnel ports with bfd, this reduces CPU usage to around 5%. When ports change status more often than every 100ms, CPU usage will increase to previous rates. Signed-off-by: Joe Stringer <joestrin...@nicira.com> --- vswitchd/bridge.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index 4a3b849..fdf0000 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -133,6 +133,7 @@ struct bridge { struct list ofpp_garbage; /* "struct ofpp_garbage" slated for removal. */ struct hmap if_cfg_todo; /* "struct if_cfg"s slated for creation. Indexed on 'cfg->name'. */ + uint64_t change_seq; /* Track changes to netdev status. */ /* Port mirroring. */ struct hmap mirrors; /* "struct mirror" indexed by UUID. */ @@ -2219,6 +2220,14 @@ instant_stats_run(void) HMAP_FOR_EACH (br, node, &all_bridges) { struct iface *iface; struct port *port; + uint64_t seq; + + seq = netdev_change_seq(); + if (seq == br->change_seq) { + continue; + } else { + br->change_seq = seq; + } br_refresh_stp_status(br); @@ -2529,6 +2538,7 @@ bridge_wait(void) HMAP_FOR_EACH (br, node, &all_bridges) { ofproto_wait(br->ofproto); + netdev_seq_wait(br->change_seq); } poll_timer_wait_until(iface_stats_timer); } -- 1.7.9.5 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev