-
Notifications
You must be signed in to change notification settings - Fork 30
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
500 cleaned update #129
500 cleaned update #129
Conversation
Fix used memory estimation
…et value according to how we want to compile with solo5
Fix the compilation of the OCaml toolchain and specify the right target value according to how we want to compile with solo5
The last commit re-uses the bmap allocator from mirage-xen (https://github.com/mirage/mirage-xen/blob/main/lib/bindings/bmap.c) and permits to both mmap & munmap. So far it works with qubes mirage firewall (transmit traffic) and I have the same bandwith on an ADSL link (which isn't an indicator per se as the bandwidth is limited). I haven't done any other performance tests yet (the bmap allocation is O(n) with n=2048 pages, and munmap is O(1)) because I'm more worried about having to set a magic constant ("mmap size", here 8MB) in the libc startup function. |
So having an allocation for mmap leads to bad things, the Ocaml runtime runs out of memory at some point. So I'm switching to another memory allocation system:
This currently works with |
210caca
to
919bcfc
Compare
- bitmap allocator: 0 is inuse, 1 if free - remove a debug printf
It seems to work now, qubes-mirage-firewall works and routes traffic :) So far:
|
d098205
to
30ee44d
Compare
Closing this as @shym has been working on 5.2 integration and the allocator isn't well adapted. |
This PR is a rebase against current main + updates some constants to be the same as in linux.
The bad news is that I'm currently in a dead end with
mmap
/munmap
:I first wanted to use
malloc
/posix_mem_align
as it's available with dlmalloc as ammap
replacement, but going on that path led me to search how Ocaml usesmmap
/munmap
. If I understand correctly, Ocaml requests memory withmmap
(more than necessary, maybe to ensure some alignments constraints?) and then usesmunmap
to "free" pages it won't use:free
here as some pages haven't been allocated withmalloc
munmap
it works, but it leads to more memory usage/memory wasted than necessary (which isn't great as Ocaml forces an additional 2MB stack for each domains)