]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-112532: Improve mimalloc page visiting (#114133)
authorSam Gross <colesbury@gmail.com>
Mon, 22 Jan 2024 21:10:21 +0000 (16:10 -0500)
committerGitHub <noreply@github.com>
Mon, 22 Jan 2024 21:10:21 +0000 (13:10 -0800)
commit412920a41efc6f3307e710d5ce61bfe00c0f3c11
tree578dadd87be637f110278f79f15b0ea0fa2eefb9
parente45bae7a45e5696c3ebdf477ecc948374cf8ebff
gh-112532: Improve mimalloc page visiting (#114133)

This adds support for visiting abandoned pages in mimalloc and improves
the performance of the page visiting code. Abandoned pages contain
memory blocks from threads that have exited. At some point, they may be
later reclaimed by other threads. We still need to visit those pages in
the free-threaded GC because they contain live objects.

This also reduces the overhead of visiting mimalloc pages:

 * Special cases for full, empty, and pages containing only a single
   block.
 * Fix free_map to use one bit instead of one byte per block.
 * Use fast integer division by a constant algorithm when computing
   block offset from block size and index.
Include/internal/mimalloc/mimalloc/internal.h
Objects/mimalloc/heap.c
Objects/mimalloc/segment.c