Method for Reducing Overhead of Shared Memory Access Instrumentation
Qianyu Liu, Naijie Gu, Junjie Su · Proceedings of the 3rd International Conference on Computer Science and Application Engineering · 2019
Memory monitoring is crucial for understanding the memory access behavior of applications. Especially in multithreaded programs, dealing with concurrency bugs relies on tracking and analyzing accesses to shared memory. Instrumentation is widely used to obtain diagnostic information for runtime checks. However, instrumenting all memory accesses incurs a high performance overhead, slowing down a program's execution by an order of magnitude. In this paper, a simple but novel method is proposed to address performance degradation problem caused by instrumentation. It is based on the following key insight: there is no need to track those thread-local stack accesses. Recognizing such redundancy in memory access instrumentation and runtime checks, the paper presents the IIMA (Is Interesting Memory Access) algorithm to conduct instrumentation pruning. The algorithm is implemented based on LLVM infrastructure and evaluated across a range of well-designed test cases and open source benchmarks. The results show that the method is able to aggressively reduce the amount of instrumented memory accesses especially at low compilation optimization level and further reduce the runtime overhead.