-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Description
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.