• Erik Chen's avatar
    Fix an implementation bug in poisson sampling allocator. · eb53085d
    Erik Chen authored
    This CL fixes a longstanding implementation bug in poisson sampling allocator.
    The poisson sampling allocator consistently oversampled allocations,
    particularly small ones. The root cause is that muted allocations continue to
    affect g_accumulated_bytes_tls. If muted allocations were randomly distributed
    with normal allocations, this would have no net effect. However, muted
    allocations always happen right after g_accumulated_bytes_tls is reset. This
    non-randomness means that muted allocations are almost never sampled, but cause
    other allocations to be over-sampled. This CL fixes it by resetting
    g_accumulated_bytes_tls back to its original value after we unmute.
    
    This CL also fixes a test bug. To pick up the test-specified sampling rate, we
    make several large allocations, flushing the TLS variables which were still
    keyed to the old sampling rate.
    
    Bug: 843467
    Change-Id: Idea9fab3dfadc014375a3428a7839c76fc635556
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1956266
    Commit-Queue: Erik Chen <erikchen@chromium.org>
    Reviewed-by: default avatarEtienne Bergeron <etienneb@chromium.org>
    Auto-Submit: Erik Chen <erikchen@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#723064}
    eb53085d
memlog_browsertest.cc 4.45 KB