Skip to content

Commit 31e614a

Browse files
aclementstmm1
authored andcommitted
runtime: assume 64kB physical pages on ARM
Currently we assume the physical page size on ARM is 4kB. While this is usually true, the architecture also supports 16kB and 64kB physical pages, and Linux (and possibly other OSes) can be configured to use these larger page sizes. With Go 1.6, such a configuration could potentially run, but generally resulted in memory corruption or random panics. With current master, this configuration will cause the runtime to panic during init on Linux when it checks the true physical page size (and will still cause corruption or panics on other OSes). However, the assumed physical page size only has to be a multiple of the true physical page size, the scavenger can now deal with large physical page sizes, and the rest of the runtime can deal with a larger assumed physical page size than the true size. Hence, there's little disadvantage to conservatively setting the assumed physical page size to 64kB on ARM. This may result in some extra memory use, since we can only return memory at multiples of the assumed physical page size. However, it is a simple change that should make Go run on systems configured for larger page sizes. The following commits will make the runtime query the actual physical page size from the OS, but this is a simple step there. Updates golang#12480. Change-Id: I851829595bc9e0c76235c847a7b5f62ad82b5302 Reviewed-on: https://go-review.googlesource.com/25021 Run-TryBot: Austin Clements <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Minux Ma <[email protected]>
1 parent 4f7363c commit 31e614a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/runtime/internal/sys/arch_arm.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const (
88
ArchFamily = ARM
99
BigEndian = 0
1010
CacheLineSize = 32
11-
PhysPageSize = 65536*GoosNacl + 4096*(1-GoosNacl)
11+
PhysPageSize = 65536
1212
PCQuantum = 4
1313
Int64Align = 4
1414
HugePageSize = 0

0 commit comments

Comments
 (0)