mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Merge FileMem.usage in IncRef
Per the doc, usage must be kept maximally merged. Beyond that, it is simply a good idea to keep fragmentation in usage to a minimum. The glibc malloc allocator allocates one page at a time, potentially causing lots of fragmentation. However, those pages are likely to have the same number of references, often making it possible to merge ranges. PiperOrigin-RevId: 204960339 Change-Id: I03a050cf771c29a4f05b36eaf75b1a09c9465e14
This commit is contained in:
@@ -11,6 +11,7 @@ inconsistency, please file a bug.
|
||||
|
||||
The following files are implemented:
|
||||
|
||||
|
||||
| File /proc/ | Content |
|
||||
| :------------------------ | :---------------------------------------------------- |
|
||||
| [cpuinfo](#cpuinfo) | Info about the CPU |
|
||||
@@ -22,6 +23,7 @@ The following files are implemented:
|
||||
| [uptime](#uptime) | Wall clock since boot, combined idle time of all cpus |
|
||||
| [version](#version) | Kernel version |
|
||||
|
||||
|
||||
### cpuinfo
|
||||
|
||||
```bash
|
||||
|
||||
@@ -547,6 +547,8 @@ func (f *FileMem) IncRef(fr platform.FileRange) {
|
||||
if gap.Ok() {
|
||||
panic(fmt.Sprintf("IncRef(%v): attempted to IncRef on unallocated pages %v:\n%v", fr, gap.Range(), &f.usage))
|
||||
}
|
||||
|
||||
f.usage.MergeAdjacent(fr)
|
||||
}
|
||||
|
||||
// DecRef implements platform.File.DecRef.
|
||||
|
||||
Reference in New Issue
Block a user