[LTP] [PATCH 0/2] Ebizzy Benchmark Tool: Enhancements for Thread Safety and Record Count Handling
Vishal Chourasia
vishalc@linux.ibm.com
Mon Aug 14 08:18:08 CEST 2023
Patch 1: Enhancing Thread Safety in Ebizzy Benchmark Tool
This patch is aimed at improving the thread safety in the ebizzy benchmarking
tool. A potential issue was identified where the shared variable 'records_read'
was susceptible to race conditions when concurrently updated by multiple
threads. This behavior could lead to skewing of the benchmark results. To
mitigate this issue, a mutex for 'records_read' is introduced in this patch. The
mutex ensures thread-safe updates and consequently improves the reliability of
the benchmark.
Patch 2: Enhanced Record Count Handling
This patch modifies `ebizzy.c` to handle situations with high record counts more
effectively, especially when the count exceeds `UINT_MAX`. It includes adjusting
the `records_read` variable type from `unsigned int` to `unsigned long
long`. This adjustment allows the benchmark tool to handle a broader range of
record counts accurately. Additionally, the patch introduces error checking for
integer overflow during the summation of `local_records_read` to
`records_read`. Upon detecting an overflow, an appropriate error message is
displayed, and the program exits.
These improvements cater to scenarios where `ebizzy` is run with a large number
of threads over a substantial period. For example, when `ebizzy` is run for 60
seconds with 96 threads, and each thread processes between 5 to 6 million
records, the total record count can easily surpass `UINT_MAX`. This would lead
to an overflow. With these modifications, such situations are properly handled
and reported.
Vishal Chourasia (2):
Enhanced thread safety in ebizzy benchmark tool
Handle high record counts and prevent integer overflow
utils/benchmark/ebizzy-0.3/ebizzy.c | 36 ++++++++++++++++++++++++-----
1 file changed, 30 insertions(+), 6 deletions(-)
--
2.39.3
More information about the ltp
mailing list