[cache_bin] prefetch refilled pointers and add experimental fast_path_prefetch by spredolac · Pull Request #2851 · jemalloc/jemalloc · GitHub
Skip to content

[cache_bin] prefetch refilled pointers and add experimental fast_path_prefetch#2851

Open
spredolac wants to merge 1 commit intojemalloc:devfrom
spredolac:prefetch_one_comm
Open

[cache_bin] prefetch refilled pointers and add experimental fast_path_prefetch#2851
spredolac wants to merge 1 commit intojemalloc:devfrom
spredolac:prefetch_one_comm

Conversation

@spredolac
Copy link
Copy Markdown
Contributor

This change enables two features which are off by default:

  1. runtime feature which will prefetch up to nprefetch_cache_fill pointers when cache_bin is refilled (if the next pointer in the bin is on the same cacheline as the one prior to it, it will not be prefetched). On some architectures this may be worth cost to pay when it is expected that those pointers will be return for allocations that will come soon. Default value is 0 and this is not enabled.

  2. Build time feature --enable-experimental-fp-prefetch is added and if enabled it will prefetch the next pointer in the cache_bin when current one is returned to allocation call. To avoid the boundary check, we will pad the cache_bin with one extra space and put the address of that space itself so that prefetch call of the last legit element of the bin still has good address (avoiding larger performance penalty on some platforms)

Beyond unit tests, ran it on internal servers and confirmed that performance when both features were disabled was neutral, while when enabled we notice movement of CPU and TLB misses depending on memory allocation traffic patterns.

@spredolac spredolac force-pushed the prefetch_one_comm branch from e5e0d48 to 0707856 Compare May 20, 2025 20:58
@spredolac spredolac force-pushed the prefetch_one_comm branch 4 times, most recently from 9373fb8 to 0f2ddf8 Compare June 4, 2025 21:00
@spredolac spredolac force-pushed the prefetch_one_comm branch from 0f2ddf8 to bcda5c7 Compare June 5, 2025 20:20
@spredolac spredolac force-pushed the prefetch_one_comm branch from bcda5c7 to c0e9a8d Compare June 5, 2025 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant