You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found it as a part of #136, but moving discussion here:
Rust doc string for linux part says:
The size of the requested page can be specified in page bits. If not provided, the system
default is requested. The requested length should be a multiple of this, or the mapping
will fail.
There seems to be some kind of mix up here:
it seems the length doesn't have to be multiple of page size, per man page:
For mmap(), offset must be a multiple of the underlying huge page
size. The system automatically aligns length to be a multiple of the underlying huge page size.
the doc doesn't really mention that the page_bits option is used to encode OFFSET https://github.com/gim913/memmap2-rs/blob/windows-large-page-support/src/unix.rs#L287-L289 - and yes, offset on linux needs to be aligned, but as you can see, it does something weird (or maybe I'm not understanding how it's supposed to be used on linux): (u64::from(mask) & (MAP_HUGE_MASK as u64)) << MAP_HUGE_SHIFT
If I understand correctly, MAP_HUGE_SHIFT should be used to encode THE FLAG passed to mmap, NOT the offset!
There's even sample in manpage:
I found it as a part of #136, but moving discussion here:
Rust doc string for linux part says:
There seems to be some kind of mix up here:
page_bits
option is used to encode OFFSET https://github.com/gim913/memmap2-rs/blob/windows-large-page-support/src/unix.rs#L287-L289 - and yes, offset on linux needs to be aligned, but as you can see, it does something weird (or maybe I'm not understanding how it's supposed to be used on linux):(u64::from(mask) & (MAP_HUGE_MASK as u64)) << MAP_HUGE_SHIFT
If I understand correctly,
MAP_HUGE_SHIFT
should be used to encode THE FLAG passed to mmap, NOT the offset!There's even sample in manpage:
The text was updated successfully, but these errors were encountered: