Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use tls-zeroed-aligned-memory #1364

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ryoqun
Copy link
Member

@ryoqun ryoqun commented May 15, 2024

as part of eval of mimalloc (#1250 )

Problem

Perf result

all cases are measured with --block-verification-method=blockstore-processor

jemalloc

ledger processed in 24 seconds, 848 ms
ledger processed in 24 seconds, 842 ms
ledger processed in 24 seconds, 801 ms

mimalloc

ledger processed in 25 seconds, 666 ms
ledger processed in 25 seconds, 174 ms
ledger processed in 25 seconds, 77 ms

glibc

ledger processed in 24 seconds, 908 ms
ledger processed in 24 seconds, 827 ms
ledger processed in 24 seconds, 974 ms

rpmalloc

ledger processed in 24 seconds, 783 ms
ledger processed in 24 seconds, 977 ms
ledger processed in 25 seconds, 256 ms

... so, the conclusion is that all allocators are similar in terms of replay speed...

Summary of Changes

xref: solana-labs/rbpf#565

Fixes solana-labs#27275

@alessandrod
Copy link

I ended up doing exactly the same thing (a buffer pool), after my 0-filled tmpfs remap didn't work in the validator, from last week's standup:

integrated my alternative vm stack allocation impl in the validator and... it failed spectacularly. The trick I was using was to remap a 0-page in a new mapping (create a 0 filled tmpfs file, remap it over and over to allocate zeroed memory). That works great if you allocate from a relatively low number of threads. I discovered it breaks horribly if you allocate from a bazillion threads (like the validator does), because linux uses a rwlock on current->vm (the tree used to track vmas), and if you mmap from multiple threads that lock becomes write contended. So I begrudgingly scrapped that and implemented a thread-local buffer pool instead (not Recycler because that uses a lock), which seems to work, but needs some more love.

😅

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.8%. Comparing base (f54c120) to head (20e012f).
Report is 3 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1364   +/-   ##
=======================================
  Coverage    82.8%    82.8%           
=======================================
  Files         872      872           
  Lines      369252   369291   +39     
=======================================
+ Hits       305797   305867   +70     
+ Misses      63455    63424   -31     

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.

Poor jemalloc performance with zeroed allocations leading to TLB shootdown
3 participants