diff options
author | Adin Scannell <ascannell@google.com> | 2018-08-22 14:14:32 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-08-22 14:16:04 -0700 |
commit | a7a8d07d7d6bd551d96621ee841b1b0e0f217ca3 (patch) | |
tree | 5f38abf432d5713731f6555a17d5e4ea27c1e64d /pkg/sentry/platform/kvm | |
parent | bbee911179aaf925f58051de4392502743539802 (diff) |
Add separate Recycle method for allocator.
This improves debugging for pagetable-related issues.
PiperOrigin-RevId: 209827795
Change-Id: I4cfa11664b0b52f26f6bc90a14c5bb106f01e038
Diffstat (limited to 'pkg/sentry/platform/kvm')
-rw-r--r-- | pkg/sentry/platform/kvm/address_space.go | 3 | ||||
-rw-r--r-- | pkg/sentry/platform/kvm/allocator.go | 7 |
2 files changed, 10 insertions, 0 deletions
diff --git a/pkg/sentry/platform/kvm/address_space.go b/pkg/sentry/platform/kvm/address_space.go index fbd11ed71..463617170 100644 --- a/pkg/sentry/platform/kvm/address_space.go +++ b/pkg/sentry/platform/kvm/address_space.go @@ -273,6 +273,9 @@ func (as *addressSpace) Unmap(addr usermem.Addr, length uint64) { Start: addr, End: addr + usermem.Addr(length), }) + + // Recycle any freed intermediate pages. + as.pageTables.Allocator.Recycle() } } diff --git a/pkg/sentry/platform/kvm/allocator.go b/pkg/sentry/platform/kvm/allocator.go index 80066bfc5..f5cebd5b3 100644 --- a/pkg/sentry/platform/kvm/allocator.go +++ b/pkg/sentry/platform/kvm/allocator.go @@ -67,3 +67,10 @@ func (a allocator) LookupPTEs(physical uintptr) *pagetables.PTEs { func (a allocator) FreePTEs(ptes *pagetables.PTEs) { a.base.FreePTEs(ptes) } + +// Recycle implements pagetables.Allocator.Recycle. +// +//go:nosplit +func (a allocator) Recycle() { + a.base.Recycle() +} |