Hi everyone, I am a newcomer reading Go runtime code, and I noticed that
```go
type scavChunkData struct {
// Only the first 10 bits are used.
inUse uint16

// Only the first 10 bits are used.
lastInUse uint16

// gen is the generation counter from a scavengeIndex from the
// last time this scavChunkData was updated.
gen uint32

// Note: only 6 bits are available.
scavChunkFlags
}
```

in scavChunkData, we only use 1-bit of scavChunkFlags to indicate whether 
there is free pages in a chunk. This could be imprecise because we use the 
following code to compute whether there are free pages,
```go
nofree = inUse == pagesInChunk
```

I think we could use a 10-bit counter to record how many pages are freed. 
Why go use a 1-bit flag instead of a 10-bit counter? Is it for performance 
reasons?

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/golang-nuts/8d4b7700-7718-4f25-9424-a1bb91e22eefn%40googlegroups.com.

Reply via email to