From: Dmitriy Vyukov Date: Wed, 29 Jan 2014 14:18:46 +0000 (+0400) Subject: runtime: prepare for 8K pages X-Git-Tag: go1.3beta1~846 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=327e431057f0e367e7287c3cc4326196f53218cb;p=gostls13.git runtime: prepare for 8K pages Ensure than heap is PageSize aligned. LGTM=iant R=iant, dave, gobot CC=golang-codereviews https://golang.org/cl/56630043 --- diff --git a/src/pkg/runtime/malloc.goc b/src/pkg/runtime/malloc.goc index b00d690aad..a593da486c 100644 --- a/src/pkg/runtime/malloc.goc +++ b/src/pkg/runtime/malloc.goc @@ -427,7 +427,6 @@ runtime·mallocinit(void) byte *p; uintptr arena_size, bitmap_size, spans_size; extern byte end[]; - byte *want; uintptr limit; uint64 i; @@ -486,7 +485,7 @@ runtime·mallocinit(void) spans_size = ROUND(spans_size, PageSize); for(i = 0; i <= 0x7f; i++) { p = (void*)(i<<40 | 0x00c0ULL<<32); - p = runtime·SysReserve(p, bitmap_size + spans_size + arena_size); + p = runtime·SysReserve(p, bitmap_size + spans_size + arena_size + PageSize); if(p != nil) break; } @@ -528,16 +527,16 @@ runtime·mallocinit(void) // So adjust it upward a little bit ourselves: 1/4 MB to get // away from the running binary image and then round up // to a MB boundary. - want = (byte*)ROUND((uintptr)end + (1<<18), 1<<20); - p = runtime·SysReserve(want, bitmap_size + spans_size + arena_size); + p = (byte*)ROUND((uintptr)end + (1<<18), 1<<20); + p = runtime·SysReserve(p, bitmap_size + spans_size + arena_size + PageSize); if(p == nil) runtime·throw("runtime: cannot reserve arena virtual address space"); - if((uintptr)p & (((uintptr)1<