mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Unmap (prev.End, next.Start) during pma invalidation.
This should allow lower-layers to clean-up intermediate structures more effectively, without additional heavy-lifting. PiperOrigin-RevId: 476144809
This commit is contained in:
committed by
gVisor bot
parent
09b4b76598
commit
4bb25e196d
+21
-1
@@ -626,7 +626,27 @@ func (mm *MemoryManager) invalidateLocked(ar hostarch.AddrRange, invalidatePriva
|
||||
// Unmap all of ar, not just pseg.Range(), to minimize host
|
||||
// syscalls. AddressSpace mappings must be removed before
|
||||
// mm.decPrivateRef().
|
||||
mm.unmapASLocked(ar)
|
||||
//
|
||||
// Note that we do more than just ar here, and extrapolate
|
||||
// to the end of any previous region that we may have mapped.
|
||||
// This is done to ensure that lower layers can fully invalidate
|
||||
// intermediate pagetable pages during the unmap.
|
||||
var unmapAR hostarch.AddrRange
|
||||
if prev := pseg.PrevSegment(); prev.Ok() {
|
||||
unmapAR.Start = prev.End()
|
||||
} else {
|
||||
unmapAR.Start = mm.layout.MinAddr
|
||||
}
|
||||
if last := mm.pmas.LowerBoundSegment(ar.End); last.Ok() {
|
||||
if last.Start() < ar.End {
|
||||
unmapAR.End = ar.End
|
||||
} else {
|
||||
unmapAR.End = last.Start()
|
||||
}
|
||||
} else {
|
||||
unmapAR.End = mm.layout.MaxAddr
|
||||
}
|
||||
mm.unmapASLocked(unmapAR)
|
||||
didUnmapAS = true
|
||||
}
|
||||
if pma.private {
|
||||
|
||||
Reference in New Issue
Block a user