-
Notifications
You must be signed in to change notification settings - Fork 68
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
Set EOS VM OC max mirroring pages to a small number for read-only threads #1488
Conversation
// Set mirroring_pages_for_ro_thread to a small number to save upfront virtual memory | ||
// consumption. Usage beyond this limit will be handled by mprotect. | ||
constexpr uint32_t mirroring_pages_for_ro_thread = 10; | ||
thread_local eosvmoc::memory eosvmoc_runtime::mem_thread_local{mirroring_pages_for_ro_thread}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm kind of surprised this works... but best I can tell from reading the code thoroughly is that it does what we want correctly.
I may suggest we change the name of the ctor parameter,
memory::memory(uint64_t max_pages) { |
from
max_pages
to sliced_pages
(or something else). It probably was "max pages" in 2.0, but its meaning has changed in 2.1/3.0.5.
I'd also suggest we remove
void memory::reset(uint64_t max_pages) { |
afaict it isn't used (I removed it locally and the build worked at least).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I made the suggested changes. The code is even cleaner.
…ed_pages and delete unused memory::reset(uint64_t max_pages)
A part of eosnetworkfoundation/product#149.
Per the design in https://github.com/eosnetworkfoundation/product/blob/main/transactions/read-only/memory.md, to conserve virtual memory to support more threads, we need to reduce the threshold where EOS VM OC transitions from mirroring to
mprotect()
.We plan to keep 528 pages (529 slices) for the main-thread memory (currently used for anything other then read-only transaction threads); this ensures maximum performance for EVM transactions. For each read-only thread, we set 10 pages (11 slices) (10 pages covers 99% native actions and 56% EVM actions, from data collected by in #1159).
With maximum 256 read-only threads , virtual memory required by OC is 26 TB (OC's main thread uses 4TB VM (by 529 slices) and the read-only threads use 22TB (256 * 11 * 8GB)). It is about 20% of total VM space in a 64-bit Linux machine (about 128TB).
The coding is much simpler.
Resolves #645