Fuchsia is migrating to a variable page size.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
The CL seems fine, but should we use sanitizer_common's GetPageSizeCached()[0] where we call GetPageSize() ? Fuchsia documentation indicates that it's OK for user apps to cache that value.
[0]: https://github.com/llvm/llvm-project/blob/main/compiler-rt/lib/sanitizer_common/sanitizer_common.h#L72-L78
[1]: https://fuchsia.dev/fuchsia-src/contribute/governance/rfcs/0016_boot_time_page_sizes
It's fine to cache the value, but the question is whether it's worthwhile. The zx_system_get_page_size() call is literally a shared library function call that returns the value of a global variable. So it's already just as cheap as a local cache would be except for the PLT overhead of calling a shared library function rather than a local function (that might be LTO'd away to direct access to the global). I don't have data, but my intuition is that all in all the PLT overhead in those calls does less harm than the extra code and data space for a local cache.
Ah! It is already in the VDSO! I thought it was a regular system call, my bad. Fuchsia should probably document that.
It is not really part of the semantics how the vDSO is implemented. But it is the case that all the zx_system_get_* calls are quite cheap and we could at least document that expectation.