Commit e6fb39aa authored by Michael Anthony Knyszek's avatar Michael Anthony Knyszek Committed by Brad Fitzpatrick

runtime: make the test addresses for pageAlloc smaller on 32-bit

This change makes the test addresses start at 1 GiB instead of 2 GiB to
support mips and mipsle, which only have 31-bit address spaces.

It also changes some tests to use smaller offsets for the chunk index to
avoid jumping too far ahead in the address space to support 31-bit
address spaces. The tests don't require such large jumps for what
they're testing anyway.

Updates #35112.
Fixes #35440.

Change-Id: Ic68ff2b0a1f10ef37ac00d4bb5b910ddcdc76f2e
Reviewed-on: https://go-review.googlesource.com/c/go/+/205938
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarKeith Randall <khr@golang.org>
Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
parent 78d45607
...@@ -830,7 +830,10 @@ func FreePageAlloc(pp *PageAlloc) { ...@@ -830,7 +830,10 @@ func FreePageAlloc(pp *PageAlloc) {
// BaseChunkIdx is a convenient chunkIdx value which works on both // BaseChunkIdx is a convenient chunkIdx value which works on both
// 64 bit and 32 bit platforms, allowing the tests to share code // 64 bit and 32 bit platforms, allowing the tests to share code
// between the two. // between the two.
var BaseChunkIdx = ChunkIdx(chunkIndex((0xc000*pageAlloc64Bit + 0x200*pageAlloc32Bit) * pallocChunkBytes)) //
// This should not be higher than 0x100*pallocChunkBytes to support
// mips and mipsle, which only have 31-bit address spaces.
var BaseChunkIdx = ChunkIdx(chunkIndex((0xc000*pageAlloc64Bit + 0x100*pageAlloc32Bit) * pallocChunkBytes))
// PageBase returns an address given a chunk index and a page index // PageBase returns an address given a chunk index and a page index
// relative to that chunk. // relative to that chunk.
......
...@@ -280,23 +280,23 @@ func TestPageAllocAlloc(t *testing.T) { ...@@ -280,23 +280,23 @@ func TestPageAllocAlloc(t *testing.T) {
"NotContiguousPallocChunkPages*2": { "NotContiguousPallocChunkPages*2": {
before: map[ChunkIdx][]BitRange{ before: map[ChunkIdx][]BitRange{
BaseChunkIdx: {}, BaseChunkIdx: {},
BaseChunkIdx + 0x100: {}, BaseChunkIdx + 0x40: {},
BaseChunkIdx + 0x101: {}, BaseChunkIdx + 0x41: {},
}, },
scav: map[ChunkIdx][]BitRange{ scav: map[ChunkIdx][]BitRange{
BaseChunkIdx: {{0, PallocChunkPages}}, BaseChunkIdx: {{0, PallocChunkPages}},
BaseChunkIdx + 0x100: {}, BaseChunkIdx + 0x40: {},
BaseChunkIdx + 0x101: {}, BaseChunkIdx + 0x41: {},
}, },
hits: []hit{ hits: []hit{
{PallocChunkPages * 2, PageBase(BaseChunkIdx+0x100, 0), 0}, {PallocChunkPages * 2, PageBase(BaseChunkIdx+0x40, 0), 0},
{21, PageBase(BaseChunkIdx, 0), 21 * PageSize}, {21, PageBase(BaseChunkIdx, 0), 21 * PageSize},
{1, PageBase(BaseChunkIdx, 21), PageSize}, {1, PageBase(BaseChunkIdx, 21), PageSize},
}, },
after: map[ChunkIdx][]BitRange{ after: map[ChunkIdx][]BitRange{
BaseChunkIdx: {{0, 22}}, BaseChunkIdx: {{0, 22}},
BaseChunkIdx + 0x100: {{0, PallocChunkPages}}, BaseChunkIdx + 0x40: {{0, PallocChunkPages}},
BaseChunkIdx + 0x101: {{0, PallocChunkPages}}, BaseChunkIdx + 0x41: {{0, PallocChunkPages}},
}, },
}, },
"StraddlePallocChunkPages*2": { "StraddlePallocChunkPages*2": {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment