[sgen] Refactor collection logging
authorVlad Brezae <brezaevlad@gmail.com>
Wed, 25 May 2016 00:04:40 +0000 (03:04 +0300)
committerVlad Brezae <brezaevlad@gmail.com>
Fri, 27 May 2016 17:17:43 +0000 (20:17 +0300)
commit52d58c1c5d1770f2c45cbe22b6f2a80b1f886dcc
tree4ff7c45633cc9d7c36ea28b77dc7d12820eb240f
parent8c8ce9f3bd2145433dd0f91aab80294d277ec711
[sgen] Refactor collection logging

We had the problem that we were logging at sweep finish which can happen anytime. If we happen to suspend a thread, while doing a GC, in the middle of logging we might deadlock if we wait for sweep to finish (which can be blocked waiting for logging).

When logging multiple collections in the same stw pause, we would not log the real results for both collections since we would compute the major sizes at the very end.

We logged collections in sgen_perform_collection, outside the function calls for specific collections, which makes it cumbersome to add additional log entries.

This refactoring solves these issues by having GC code log info at any time. This log entry is enqueued in a list of pending entries. We flush the list of logs, as before, at the end of the stw, when the world is restarted.
mono/metadata/sgen-mono.c
mono/metadata/sgen-stw.c
mono/sgen/sgen-client.h
mono/sgen/sgen-gc.c
mono/sgen/sgen-gc.h
mono/sgen/sgen-memory-governor.c
mono/sgen/sgen-memory-governor.h