Commit Graph

5 Commits

Author SHA1 Message Date
Justin Starry 0d1ad0dc1d
Reuse compute budget processing (#1700)
* refactor: reuse compute budget limits

* fix tests
2024-06-20 19:22:19 +00:00
Alessandro Decina 2107adcf35
bpf_loader: use an explicit thread-local pool for stack and heap memory (#1370)
* Rename ComputeBudget::max_invoke_stack_height to max_instruction_stack_depth

The new name is consistent with the existing
ComputeBudget::max_instruction_trace_length.

Also expose compute_budget:MAX_INSTRUCTION_DEPTH.

* bpf_loader: use an explicit thread-local pool for stack and heap memory

Use a fixed thread-local pool to hold stack and heap memory. This
mitigates the long standing issue of jemalloc causing TLB shootdowns to
serve such frequent large allocations.

Because we need 1 stack and 1 heap region per instruction, and the
current max instruction nesting is hardcoded to 5, the pre-allocated
size is (MAX_STACK + MAX_HEAP) * 5 * NUM_THREADS. With the current
limits that's about 2.5MB per thread. Note that this is memory that
would eventually get allocated anyway, we're just pre-allocating it now.

* programs/sbf: add test for stack/heap zeroing

Add TEST_STACK_HEAP_ZEROED which tests that stack and heap regions are
zeroed across reuse from the memory pool.
2024-06-20 08:57:11 +07:00
Joe C 20549d9342
compute budget: add frozen-abi build script (#1653)
compute budget: frozen-abi build script
2024-06-10 13:09:10 -05:00
Joe C 0bf34e5ca1
Compute Budget: add `frozen-abi` feature (#1606)
compute budget: add `frozen-abi` feature
2024-06-05 09:20:50 -05:00
Joe C 62eb4cc068
Add Compute Budget Crate (#1121) 2024-06-01 01:38:19 -05:00