diff options
author | Alex Wang <alexw@nicira.com> | 2015-08-13 11:31:49 -0700 |
---|---|---|
committer | Alex Wang <alexw@nicira.com> | 2015-08-25 16:21:36 -0700 |
commit | fbe0962b28808a24fc2bff8b5d17cb0c46756c59 (patch) | |
tree | cade54bafa5ab1dd8d9e2e37357dc44ffe118e55 /lib/coverage.h | |
parent | d1cec3c6e3fc02d3750633116b62634a44e83f33 (diff) | |
download | openvswitch-fbe0962b28808a24fc2bff8b5d17cb0c46756c59.tar.gz |
coverage: Add coverage_try_clear() for performance-critical threads.
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@samsung.com>
Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com
Diffstat (limited to 'lib/coverage.h')
-rw-r--r-- | lib/coverage.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/coverage.h b/lib/coverage.h index 832c433ee..34a04aa6b 100644 --- a/lib/coverage.h +++ b/lib/coverage.h @@ -88,6 +88,7 @@ void coverage_counter_register(struct coverage_counter*); void coverage_init(void); void coverage_log(void); void coverage_clear(void); +void coverage_try_clear(void); void coverage_run(void); #endif /* coverage.h */ |