Skip to content

Commit aa4fa1b

Browse files
committed
Add page size policy documentation
Signed-off-by: Michael Jarrett <[email protected]>
1 parent 83b2f68 commit aa4fa1b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

DESIGN.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,22 @@ let buf = &mut [0u8; 5];
122122
let result = guest_memory_mmap.write(buf, addr);
123123
```
124124

125+
#### Page Size Policy
126+
127+
For regions backed by a call to `mmap`, the user may specify the desired page size
128+
and behavior expected by the operating system. The current options include:
129+
130+
- `BasePages`: The standard page size provided by the operating system.
131+
- `TransparentHugepages`: (Implemented only for Unix-like systems) Hints to the operating
132+
system that base pages can be combined transparently into larger page sizes. Concretely,
133+
mappings with this policy will invoke `madvise` with the `MADV_HUGEPAGE` flag.
134+
- `ExplicitHugepages`: Requests that the entire mapping be explicitly mapped to a pre-reserved
135+
pool of hugepages. Concretely, mappings with this policy will include the `MAP_HUGETLB` flag
136+
in the call to `mmap`. **NOTE:** If the operating system has no available hugepages (e.g. on Linux,
137+
if `cat /proc/sys/vm/nr_hugepages` reads 0), then the mapping, or attempts to dereference addresses
138+
within the region, may fail. It is the responsibility of the VMM to ensure that hugepages are
139+
available for use before constructing a mapping with this policy.
140+
125141
### Utilities and Helpers
126142

127143
The following utilities and helper traits/macros are imported from the

0 commit comments

Comments
 (0)