[ovs-dev] [PATCH] coverage: Synchronize per-thread counters less aggressively

Ben Pfaff blp at nicira.com
Wed Nov 20 23:03:54 UTC 2013


On Fri, Nov 15, 2013 at 03:25:00PM -0800, Joe Stringer wrote:
> When profiling CPU usage in situations involving high numbers of ports,
> coverage_clear() was highlighted as a commonly called function. It
> appears that it can be quite expensive to access all of the per-thread
> coverage counters when threads are constantly waking up.
> 
> This patch makes each thread only do coverage_clear() logic roughly once
> per second by introducing per-thread timers. Upcall handler counters may
> become less accurate, as these threads may sleep without synchronising
> and not wake up for some time. When the main thread is under load at
> ~90% CPU, this drops to ~85%. Upcall handler threads sitting at ~2.5%
> drop to ~1.5%.
> 
> Signed-off-by: Joe Stringer <joestringer at nicira.com>

Applied, thanks.

> The existing ARP modification slow-path test fails with this patch, as
> the upcall handler goes to sleep before synchronising its per-thread
> counters, and warping the time does not affect handler threads. This
> patch removes the conflicting part of the test. An alternative is to
> introduce a coverage_clear_now() function to be called from the upcall
> handler, if we are not concerned about the performance difference for
> upcall handlers.

For now, I decided to just apply your patch.



More information about the dev mailing list