ref: c8794878730e4602be2b0de154e8aa8a4d26a491
parent: 0f831d24c57a8770c1c45275d689b1703b52be1b
author: Ori Bernstein <[email protected]>
date: Thu Aug 2 14:24:41 EDT 2012
Rename Pagesz to Slabsz. We will start allocating far larger slabs, and aligning them ourselves, in order to make medium sized allocations more efficient. This means that we won't have massive amounts of slop between a reasonable divisor of the page size and a reasonable number of pages of allocation size.
--- a/alloc.myr
+++ b/alloc.myr
@@ -18,9 +18,9 @@
const Zslab = 0 castto(slab*)
const Zchunk = 0 castto(chunk*)
-const Pagesz = 4096 /* on the systems this supports, anyways... */
+const Slabsz = 4096 /* on the systems this supports, anyways... */
const Cachemax = 16 /* maximum number of slabs in the cache */
-const Bucketmax = 1024 /* Pagesz / 8; a balance. */
+const Bucketmax = 1024 /* Slabsz / 8; a balance. */
const Align = 16 /* minimum allocation alignment */
var buckets : bucket[32] /* excessive */
@@ -95,7 +95,7 @@
const bktinit = {b : bucket*, sz
b.sz = align(sz, Align)
- b.nper = (Pagesz - sizeof(slab))/b.sz
+ b.nper = (Slabsz - sizeof(slab))/b.sz
b.slabs = Zslab
b.cache = Zslab
b.ncache = 0
@@ -114,7 +114,7 @@
bkt.cache = s.next
bkt.ncache--
;;
- p = mmap(Zbyte, Pagesz, Mprotrw, Mpriv | Manon, -1, 0)
+ p = mmap(Zbyte, Slabsz, Mprotrw, Mpriv | Manon, -1, 0)
if p == Mapbad
die("Unable to mmap")
;;
@@ -164,7 +164,7 @@
var s
var b
- s = mtrunc(m, Pagesz) castto(slab*)
+ s = mtrunc(m, Slabsz) castto(slab*)
b = m castto(chunk*)
if s.nfree == 0
s.next = bkt.slabs
@@ -174,7 +174,7 @@
s.next = bkt.cache
bkt.cache = s
else
- munmap(s castto(byte*), Pagesz)
+ munmap(s castto(byte*), Slabsz)
;;
;;
s.nfree++