https://bugs.kde.org/show_bug.cgi?id=446103
Bug ID: 446103 Summary: Memcheck: `--track-origins=yes` causes extreme slowdowns for large mmap/munmap Product: valgrind Version: unspecified Platform: Other OS: Linux Status: REPORTED Severity: normal Priority: NOR Component: memcheck Assignee: jsew...@acm.org Reporter: jsew...@acm.org Target Milestone: --- Created attachment 143957 --> https://bugs.kde.org/attachment.cgi?id=143957&action=edit C test case The attached test program repeatedly mmaps/munmaps a 2GB chunk of memory. Without `--track-origins=yes`, it runs in about 0.7 seconds. But with origin tracking enabled, it takes 95.5 seconds, that is, it runs 137 times slower. The problem occurs because the 2GB mmaps/munmaps cause Memcheck to perform a set-address-range-perms operation on the area, changing it to "defined" and then back to "noaccess". Large-range SARPs are (highly) optimised for the V/A-bit (normal) Memcheck shadow memory, but they are very inefficient for the origin-tracking shadow area. Origin-tracking shadows are kept in a 64MB 2-way set associative cache, which is pretty fast. But lines ejected from that are kept in a OSet (AVL-tree) based backing store. Because these SARP lengths greatly exceed the size of the cache, a huge AVL tree is created, which is very time- and space-inefficient. This was initially noticed in https://bugzilla.mozilla.org/show_bug.cgi?id=1742851. -- You are receiving this mail because: You are watching all bug changes.