• Austin Clements's avatar
    runtime: support a two-level arena map · ec252105
    Austin Clements authored
    Currently, the heap arena map is a single, large array that covers
    every possible arena frame in the entire address space. This is
    practical up to about 48 bits of address space with 64 MB arenas.
    
    However, there are two problems with this:
    
    1. mips64, ppc64, and s390x support full 64-bit address spaces (though
       on Linux only s390x has kernel support for 64-bit address spaces).
       On these platforms, it would be good to support these larger
       address spaces.
    
    2. On Windows, processes are charged for untouched memory, so for
       processes with small heaps, the mostly-untouched 32 MB arena map
       plus a 64 MB arena are significant overhead. Hence, it would be
       good to reduce both the arena map size and the arena size, but with
       a single-level arena, these are inversely proportional.
    
    This CL adds support for a two-level arena map. Arena frame numbers
    are now divided into arenaL1Bits of L1 index and arenaL2Bits of L2
    index.
    
    At the moment, arenaL1Bits is always 0, so we effectively have a
    single level map. We do a few things so that this has no cost beyond
    the current single-level map:
    
    1. We embed the L2 array directly in mheap, so if there's a single
       entry in the L2 array, the representation is identical to the
       current representation and there's no extra level of indirection.
    
    2. Hot code that accesses the arena map is structured so that it
       optimizes to nearly the same machine code as it does currently.
    
    3. We make some small tweaks to hot code paths and to the inliner
       itself to keep some important functions inlined despite their
       now-larger ASTs. In particular, this is necessary for
       heapBitsForAddr and heapBits.next.
    
    Possibly as a result of some of the tweaks, this actually slightly
    improves the performance of the x/benchmarks garbage benchmark:
    
    name                       old time/op  new time/op  delta
    Garbage/benchmem-MB=64-12  2.28ms ± 1%  2.26ms ± 1%  -1.07%  (p=0.000 n=17+19)
    
    (https://perf.golang.org/search?q=upload:20180223.2)
    
    For #23900.
    
    Change-Id: If5164e0961754f97eb9eca58f837f36d759505ff
    Reviewed-on: https://go-review.googlesource.com/96779
    Run-TryBot: Austin Clements <austin@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarRick Hudson <rlh@golang.org>
    ec252105
Name
Last commit
Last update
..
builtin Loading commit data...
testdata Loading commit data...
alg.go Loading commit data...
align.go Loading commit data...
asm_test.go Loading commit data...
bexport.go Loading commit data...
bimport.go Loading commit data...
bitset.go Loading commit data...
bootstrap.go Loading commit data...
builtin.go Loading commit data...
builtin_test.go Loading commit data...
bv.go Loading commit data...
class_string.go Loading commit data...
closure.go Loading commit data...
const.go Loading commit data...
constFold_test.go Loading commit data...
dcl.go Loading commit data...
dwinl.go Loading commit data...
esc.go Loading commit data...
export.go Loading commit data...
fixedbugs_test.go Loading commit data...
float_test.go Loading commit data...
fmt.go Loading commit data...
gen.go Loading commit data...
global_test.go Loading commit data...
go.go Loading commit data...
gsubr.go Loading commit data...
iface_test.go Loading commit data...
init.go Loading commit data...
inl.go Loading commit data...
inl_test.go Loading commit data...
lex.go Loading commit data...
lex_test.go Loading commit data...
logic_test.go Loading commit data...
main.go Loading commit data...
mkbuiltin.go Loading commit data...
mpfloat.go Loading commit data...
mpint.go Loading commit data...
noder.go Loading commit data...
norace.go Loading commit data...
obj.go Loading commit data...
op_string.go Loading commit data...
order.go Loading commit data...
pgen.go Loading commit data...
pgen_test.go Loading commit data...
phi.go Loading commit data...
plive.go Loading commit data...
pprof.go Loading commit data...
race.go Loading commit data...
racewalk.go Loading commit data...
range.go Loading commit data...
reflect.go Loading commit data...
reflect_test.go Loading commit data...
reproduciblebuilds_test.go Loading commit data...
scope.go Loading commit data...
scope_test.go Loading commit data...
select.go Loading commit data...
shift_test.go Loading commit data...
sinit.go Loading commit data...
sizeof_test.go Loading commit data...
ssa.go Loading commit data...
ssa_test.go Loading commit data...
subr.go Loading commit data...
swt.go Loading commit data...
swt_test.go Loading commit data...
syntax.go Loading commit data...
timings.go Loading commit data...
trace.go Loading commit data...
truncconst_test.go Loading commit data...
typecheck.go Loading commit data...
types.go Loading commit data...
types_acc.go Loading commit data...
universe.go Loading commit data...
unsafe.go Loading commit data...
util.go Loading commit data...
walk.go Loading commit data...