VG_(discard_translations): try to avoid invalidating the entire VG_(tt_fast) cache...
commita05a920edcf0490529815d77d2d0cc47c121c120
authorJulian Seward <jseward@acm.org>
Fri, 25 Jan 2019 11:06:37 +0000 (25 12:06 +0100)
committerJulian Seward <jseward@acm.org>
Fri, 25 Jan 2019 11:06:37 +0000 (25 12:06 +0100)
tree661ffe7c8518e6452caec470fdc4b0a82a19bf10
parentf4072abf6bc9e7791e7b34157fb25210a523dba9
VG_(discard_translations): try to avoid invalidating the entire VG_(tt_fast) cache.  n-i-bz.

It is very commonly the case that a call to VG_(discard_translations) results
in the discarding of exactly one superblock.  In such cases, it's much cheaper
to find and invalidate the VG_(tt_fast) cache entry associated with the block,
than it is to invalidate the entire cache, because

(1) invalidating the fast cache is expensive, and

(2) repopulating the fast cache after invalidation is even more expensive.

For QEMU, which intensively invalidates individual translations (presumably
due to patching them), this reduces the fast-cache miss rate from circa one in
33 lookups to around one in 130 lookups.
coregrind/m_transtab.c