| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
const nbytes = npages_ * 8192
const heapBitsReserve = (1 - noscanint_) * nbytes / int(goarch.PtrSize) / 8
const gcInlineMarkBitsReserve = int(unsafe.Sizeof(spanInlineMarkBits{})) // same on 32 and 64-bit platforms
var nelemsGreenTea = uintptr(nbytes-gcInlineMarkBitsReserve-heapBitsReserve) / elemsizeWhere did this come from? The calculation seems quite different from the base nextFreeFastTiny.
var nelemsNoGreenTea = uintptr(nbytes-heapBitsReserve) / elemsizeNo need to rip it out now, but IMO don't even try to support sizespecializedmalloc for !greentea. Basically no one uses that path.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
const nbytes = npages_ * 8192
const heapBitsReserve = (1 - noscanint_) * nbytes / int(goarch.PtrSize) / 8
const gcInlineMarkBitsReserve = int(unsafe.Sizeof(spanInlineMarkBits{})) // same on 32 and 64-bit platforms
var nelemsGreenTea = uintptr(nbytes-gcInlineMarkBitsReserve-heapBitsReserve) / elemsizeWhere did this come from? The calculation seems quite different from the base nextFreeFastTiny.
The original code that does the calculation is in https://cs.opensource.google/go/go/+/master:src/runtime/mheap.go;l=1457;drc=d247ed00e498e9717fb7c80d126bee5a8afdb4e8:
The calculation in the green tea case is:
```
s.nelems = uint16((nbytes - reserve) / s.elemsize)
```
and reserve has two components (note that gcUsersSpanInlineMarkBits(s.elemsize) and heapBitsInSpan(s.elemsize) are always true in the size specialized case- even in the tiny case we're using a span of size 16 bytes and we only specialize in cases where heapBitsInSpan is true) They are unsafe.Sizeof(spanInlineMarkBits) (always) and nbytes/goarch.PtrSize/8 (only in the scan case)
so reserve = unsafe.Sizeof(spanInlineMarkBits) + (1-noscanint_)*(nbytes/goarch.PtrSize/8)
and
nelemsGreenTea = uint16(nbytes-gcInlineMarkBitsReserve-heapBitsReserve) / elemsize
------
It's equivalent in the tiny case(though spelled a bit differently):
``` var nelemsGreenTea = uintptr(nbytes-gcInlineMarkBitsReserve-heapBitsReserve) / elemsize // new calculation
= uintptr(nbytes-int(unsafe.Sizeof(spanInlineMarkBits{})-0) / elemsize_ // substitute gcInlineMarkBitsReserve=int(unsafe.Sizeof(spanInlineMarkBits{}), heapBitsReserve=0, elemsize = elemsize_
= uint16(nbytes-unsafe.Sizeof(spanInlineMarkBits{}))/elemsize_ // (changing type conversions since sizeof span inline markbits fits into an int and nelems fits into a uint16)
```
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
var nelemsNoGreenTea = uintptr(nbytes-heapBitsReserve) / elemsizeNo need to rip it out now, but IMO don't even try to support sizespecializedmalloc for !greentea. Basically no one uses that path.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
The logic is still right but somehow this is making performance worse. I'll take this out of review for now.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |