[ovs-dev] [PATCH] coverage: Add coverage_try_clear() for performance-critical threads.
blp at nicira.com
Fri Aug 21 19:48:10 UTC 2015
On Thu, Aug 13, 2015 at 11:48:49AM -0700, Alex Wang wrote:
> For performance-critical threads like pmd threads, we currently make them
> never call coverage_clear() to avoid contention over the global mutex
> 'coverage_mutex'. So, even though pmd thread still keeps updating their
> thread-local coverage count, the count is never attributed to the global
> total. But it is useful to have them available.
> This commit makes this happen by implementing a non-contending version
> of the clear function, coverage_try_clear(). The function will use
> the ovs_mutex_trylock() and return immediately if the mutex cannot
> be acquired. Since threads like pmd thread are always busy-looping,
> the lock will eventually be acquired.
> Requested-by: Ilya Maximets <i.maximets at samsung.com>
> Signed-off-by: Alex Wang <alexw at nicira.com>
This seems like an improvement. I can imagine better data structures
but I don't know whether they're worthwhile.
Acked-by: Ben Pfaff <blp at nicira.com>
More information about the dev