summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/usage
diff options
context:
space:
mode:
authorAyush Ranjan <ayushranjan@google.com>2020-10-19 09:00:08 -0700
committergVisor bot <gvisor-bot@google.com>2020-10-19 09:02:19 -0700
commitc206fcbfc2b951a49798a1b84e9cd3c6097ffdca (patch)
treebf074df09147f84ef88ce7ec86ddd153fad83fd6 /pkg/sentry/usage
parent9a3d8973c4fcd1475b3748c10eb3e255d44e8a20 (diff)
pgalloc: Do not hold MemoryFile.mu while calling mincore.
This change makes the following changes: - Unlocks MemoryFile.mu while calling mincore (checkCommitted) because mincore can take a really long time. Accordingly looks up the segment in the tree tree again and handles changes to the segment. - MemoryFile.UpdateUsage() can now only be called at frequency at most 100Hz. 100 Hz = linux.CLOCKS_PER_SEC. Co-authored-by: Jamie Liu <jamieliu@google.com> PiperOrigin-RevId: 337865250
Diffstat (limited to 'pkg/sentry/usage')
-rw-r--r--pkg/sentry/usage/memory.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/pkg/sentry/usage/memory.go b/pkg/sentry/usage/memory.go
index ab1d140d2..5ed6726ab 100644
--- a/pkg/sentry/usage/memory.go
+++ b/pkg/sentry/usage/memory.go
@@ -278,7 +278,7 @@ func TotalMemory(memSize, used uint64) uint64 {
}
if memSize < used {
memSize = used
- // Bump totalSize to the next largest power of 2, if one exists, so
+ // Bump memSize to the next largest power of 2, if one exists, so
// that MemFree isn't 0.
if msb := bits.MostSignificantOne64(memSize); msb < 63 {
memSize = uint64(1) << (uint(msb) + 1)