]> Cypherpunks repositories - gostls13.git/commit
runtime: simplify and cleanup mallocinit
authorAustin Clements <austin@google.com>
Fri, 13 Jan 2017 19:19:52 +0000 (14:19 -0500)
committerAustin Clements <austin@google.com>
Tue, 7 Feb 2017 18:39:15 +0000 (18:39 +0000)
commit1cc24690b80b5f78e07b6e14b8614317462da1ea
tree11b04fcfdb603a2f36afe28257e45fdf480f3b43
parentefb5eae3cf1c5f9be8cc5d4c85a7314204513b4c
runtime: simplify and cleanup mallocinit

mallocinit has evolved organically. Make a pass to clean it up in
various ways:

1. Merge the computation of spansSize and bitmapSize. These were
   computed on every loop iteration of two different loops, but always
   have the same value, which can be derived directly from _MaxMem.
   This also avoids over-reserving these on MIPS, were _MaxArena32 is
   larger than _MaxMem.

2. Remove the ulimit -v logic. It's been disabled for many releases
   and the dead code paths to support it are even more wrong now than
   they were when it was first disabled, since now we *must* reserve
   spans and bitmaps for the full address space.

3. Make it clear that we're using a simple linear allocation to lay
   out the spans, bitmap, and arena spaces. Previously there were a
   lot of redundant pointer computations. Now we just bump p1 up as we
   reserve the spaces.

In preparation for #18651.

Updates #5049 (respect ulimit).

Change-Id: Icbe66570d3a7a17bea227dc54fb3c4978b52a3af
Reviewed-on: https://go-review.googlesource.com/35252
Reviewed-by: Russ Cox <rsc@golang.org>
src/runtime/malloc.go