Predator: Predictive False Sharing Detection
Tongping Liu, Chen Tian, Ziang Hu, Emery D. Berger, PPoPP 2014.
False sharing is a notorious problem for multithreaded applications that can drastically degrade both performance and scalability. Existing approaches can precisely identify the sources of false sharing, but only report false sharing actually observed during execution; they do not generalize across executions. Because false sharing is extremely sensitive to object layout, these detectors can easily miss false sharing problems that can arise due to slight differences in memory allocation order or object placement decisions by the compiler. In addition, they cannot predict the impact of false sharing on hardware with different cache line sizes.
This paper presents Predator, a predictive software-based false sharing detector. Predator generalizes from a single execution to precisely predict false sharing that is latent in the current execution. Predator tracks accesses within a range that could lead to false sharing given different object placement. It also tracks accesses within virtual cache lines, contiguous memory ranges that span actual hardware cache lines, to predict sharing on hardware platforms with larger cache line sizes. For each, it reports the exact program location of predicted false sharing problems, ranked by their projected impact on performance. We evaluate Predator across a range of benchmarks and actual applications. Predator identifies problems undetectable with previous tools, including two previously-unknown false sharing problems, with no false positives. Predator is able to immediately locate false sharing problems in MySQL and the
Boost library that had eluded detection for years.