-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
x/sys/unix: Getpagesize can return wrong value for Solaris #12076
Comments
I will provide a CL soon with a proposed change for this. |
Please discussion your change first. |
I linked to the discussion thread on golang-dev; was there a specific concern to be addressed? |
I am sorry, I thought this change was being proposed to the main repository. |
CL https://golang.org/cl/14421 mentions this issue. |
Was fixed by: |
In preparation for issues such as golang#10180, Getpagesize() needs to be fixed to return the actual system's page size instead of assuming it's always 4096. This is particularly important for future platform support on Solaris. Fixes golang#12076 Change-Id: I78205165909529215fe93ed6ba56e9c3ee1c2abb Reviewed-on: https://go-review.googlesource.com/14483 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Getpsagesize hardcodes the return value of 4096 for Solaris. The default pagesize on Solaris for amd64 can actually vary:
$ pagesize -a
4096
2097152
1073741824
With that said, Solaris currently defaults to 4096 for amd64, but this could change at some future point. And for other architectures (admittedly not yet supported by Go, but that are in development)
the default pagesize is definitely different, for example, SPARC where the default is currently 8192 although the default may change in the near future as current SPARC systems max out at 64 Terabytes of memory:
$ pagesize -a
8192
65536
4194304
268435456
2147483648
Issue 10180 touches on this subject, but in the context of cmd/link. A response to my inquiry on golang-dev suggested that x/sys/unix (at least) should just return whatever the POSIX interface for page size returns:
https://groups.google.com/forum/#!topic/golang-dev/ZLzxYzULzU8
As such, I'm proposing to change x/sys/unix Getpagesize to use sysconf(3C) to get the actual value (and cache it, since the value never changes after the system boots) and return that instead.
The text was updated successfully, but these errors were encountered: