Fix to avoid stalling the process when ETW is doing a rundown (#8357)
authorVance Morrison <vancem@microsoft.com>
Wed, 30 Nov 2016 19:45:17 +0000 (11:45 -0800)
committerJan Kotas <jkotas@microsoft.com>
Wed, 30 Nov 2016 19:45:17 +0000 (11:45 -0800)
commite26e3551994fd89f9360da7a463628cb7dbe67c5
treed4a7e63cfe983ea8d2eb8d31a322792da44376a0
parent0dca8982abf9e3ecdc757b9e8f455eefe8e81c30
Fix to avoid stalling the process when ETW is doing a rundown (#8357)

This only matters when there are MANY JIT compiled methods, but Bing operates
in exactly this mode, and thus it stalls for several seconds while rundown completes.

This fix does not fix the problem completely, but it makes it MUCH less likely, and is
a trivial, safe fix. The problem is that as part of a GC, we do cleanup of any removed
JIT code. To do this we take a JIT code manager lock, but this is also a lock that the
JIT code iterator takes and is used during ETW rundown. Thus rundown blocks GCs.

Almost all the time, we DON'T have JIT code manager cleanup to do, so we just avoid
taking the lock in that case, and this makes the stall MUCH less likely.
src/vm/codeman.cpp