Skip to content

use dmt, disable direct stable page charging#10536

Draft
michael-weigelt wants to merge 26 commits into
masterfrom
mwe/dmt_for_stable
Draft

use dmt, disable direct stable page charging#10536
michael-weigelt wants to merge 26 commits into
masterfrom
mwe/dmt_for_stable

Conversation

@michael-weigelt

@michael-weigelt michael-weigelt commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

This PR unifies page instruction charging. The deterministic memory tracker (DMT) now charges for all combinations of {heap, stable} x {read, write} page access types. The cost is uniform and increased to 5000 instructions per OS page (4KiB).

Unchanged is the additional cost of copying dirty pages after the message execution (3000 instructions per page).

So overall, the costs change like this:

               previously     dmt   
heap read:              0    5000  
heap write:         *1000   *5000 
stable read:            0    5000  
stable write:       *1000   *5000   

* additionally charged for copy overhead after the message (+3000)

The dirty stable pages tracking via the injected system API replacements is changed: The instruction counter is no longer decreased, because the DMT does it automatically. But the bitmap tracking of stable pages is kept, because it's still needed to limit overall stable memory access.

As a consequence of this change, heap accesses are charged deterministically and immediately (during the message/slice, rather than afterwards), which means that messages with lots of heap accesses are DTS'd properly. While this incurs additional cycle costs, it will allow us to increase the Wasm heap size to much more than the current 6GiB limit.

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