MPS issue job003929

Titlemps_arena_step uses poor estimate of collection time
Assigned userGareth Rees
Descriptionmps_arena_step calls ArenaStep which calls arenaShouldCollectWorld. This uses the following estimate for the amount of time it will take to collect the world:

    arenaSize = ArenaCommitted(arena) - ArenaSpareCommitted(arena);
    scanRate = arena->tracedSize / arena->tracedTime;
    arenaScanTime = arenaSize / scanRate;

This code has the following problems:

1. We don't want to know the "scan" rate, we want the overall collection rate, which includes the reclaim step.
2. arenaSize is a poor estimate of the amount of collection work, because it includes manually managed memory as well as automatically managed memory.
3. In particular, if there is no automatically managed memory, we will still start garbage collections, which is wrong.
4. arena->tracedSize and arena->tracedTime only grow upwards, so don't adapt to changing behaviour of the client program. Some kind of low-pass filter is needed.
Analysis1. We'll need separate notions of scannable memory and collectable memory to feed into the computation (note that SNC is scannable but not collectable).
2. For collectable memory, the sum of PoolTotalSize for all pools with AttrGC would be a good estimate (or maybe PoolTotalSize - PoolFreeSize). For scannable memory, we'll need to repeat the exercise for scannable pools. These don't have an attribute, so we'll need to add AttrSCAN.
3. See job003938.
4. Need to maintain these figures per-trace (as discussed in job003794).
How foundinspection
Created byGareth Rees
Created on2015-08-21 14:00:33
Last modified byGareth Rees
Last modified on2015-09-02 21:31:28
History2015-08-21 GDR Created.