Skip to content
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

design flaw: operating system page size is not always comptime known, but std lib assumes it is #2564

Closed
daurnimator opened this issue May 27, 2019 · 6 comments
Labels
breaking Implementing this issue could cause existing code to no longer compile or have different behavior. standard library This issue involves writing Zig code for the standard library.
Milestone

Comments

@daurnimator
Copy link
Collaborator

There is no longer just one page size; "huge pages" are well supported by modern processors and operating systems.

Originally posted by @daurnimator in #2527

@andrewrk andrewrk added the breaking Implementing this issue could cause existing code to no longer compile or have different behavior. label May 27, 2019
@andrewrk andrewrk added this to the 0.5.0 milestone May 27, 2019
@andrewrk andrewrk added the standard library This issue involves writing Zig code for the standard library. label May 27, 2019
@shawnl
Copy link
Contributor

shawnl commented May 27, 2019

Yes, but many systems make them transparent so they don't break things.

@LemonBoy
Copy link
Contributor

Yes, but many systems make them transparent so they don't break things.

It's not really transparent if you consider other architectures.

@andrewrk
Copy link
Member

user space can only know it at execution time from the aux vector

I was afraid of this being the case. This is so inconvenient that I might consider making the "page size" part of the target. I don't know yet. This will be an important decision for the limitations & capabilities of the standard library.

@andrewrk andrewrk changed the title There is more than one page size design flaw: operating system page size is not always comptime known, but std lib assumes it is May 27, 2019
@shawnl
Copy link
Contributor

shawnl commented May 27, 2019

@LemonBoy I just said that cause i'm using ppc64le and the large page sizes are automatic, but 4096 still works. That is the default config.

user space can only know it at execution time from the aux vector

This could be used with symbol multi-versioning, but it definitely is a pain.

@daurnimator
Copy link
Collaborator Author

daurnimator commented May 27, 2019

Maybe all we need is the minimum page size?
That would suffice for e.g. mmap alignment

@andrewrk
Copy link
Member

Solution: std.mem.page_size is the comptime-known minimum page size. Whether or not to rename it to "minimum_page_size" or not is a separate question.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Implementing this issue could cause existing code to no longer compile or have different behavior. standard library This issue involves writing Zig code for the standard library.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants