New issue
Advanced search Search tips

Issue 716079 link

Starred by 2 users

Issue metadata

Status: Archived
Owner: ----
Closed: Jan 10
Cc:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Use mach_vm_region(...,VM_REGION_TOP_INFO,...) instead of mincore

Project Member Reported by erikc...@chromium.org, Apr 27 2017

Issue description

The implementation of mincore iterates through every virtual page in the region, where VM_REGION_TOP_INFO just looks at aggregate stats for the region. See xnu-3789.1.32/bsd/kern/kern_mman.c:1015 and xnu-3789.1.32/osfmk/vm/vm_map.c:12152.
 
Doesn't really depend on what is the granularity here? In other words this bug title is missing the "where" part.
My guess is that here we are talking about ProcessMemoryDump::CountResidentBytes .

I don't know enough of OSX, but here's my doubt:
I fully buy that if we query a full region (as in, the result of a prior mmap operation) mincore and mach_vm_region will return the same result (maybe partially out of date % some caching effect of the OS counter, but I don't really care).
Instead my question is, what happens if you want to analyze an inner range of a mmap-ed region?
say:
void* x = mmap(4MB, ...)
mincore(x, 2MB, ...)

What will mach_vm_region return? is it even possible to pass arbitrary page-aligned addresses to it?

Concretely speaking I think that CountResidentBytes is used only by the chrome discardable MDP. I don't know if there is any guarantee that the discardable segments map 1:1 with vm regions.
Taking a step back, are we seeing the discardable MDP taking long times? Or are we planning to use that on new MDPs and it takes time?

Comment 2 by ssid@chromium.org, Apr 28 2017

If we know that discardable regions only call CountResidentBytes with whole virtual regions then I am happy with replacing the CountResidentBytes to use mach_vm_region, with a comment saying it only works for whole regions on Mac.

If there is a chance that discardable could use segments of the allocated regions then we could just add a new function to VmRegionResidentBytes() to wrap mach_vm_region.

I think the intention here is to be able to count the resident size of shared memory regions in a faster way. I am not sure if we have a similar api on Linux/Android that we could use.
Status: Archived (was: Untriaged)
Archiving P3s older than 1 year with no owner or component.

Sign in to add a comment