New issue
Advanced search Search tips

Issue 742042 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: Jul 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug

Blocking:
issue 713768



Sign in to add a comment

Use mach_vm_region instead of mincore in ProcessMemoryDump::CountResidenBytes

Project Member Reported by hajimehoshi@chromium.org, Jul 13 2017

Issue description

mincore is inefficient on macOS compared to mach API. Let's use mach_vm_region in CountResidenBytes as erikchen@ suggested at https://bugs.chromium.org/p/chromium/issues/detail?id=713768#c7.
 
Blocking: 713768
Status: Started (was: Assigned)
Note: there is a similar implementation in base/process/process_metrics_mac.cc

https://cs.chromium.org/chromium/src/base/process/process_metrics_mac.cc?type=cs&q=GetTopInfo&sq=package:chromium&l=153
Project Member

Comment 3 by bugdroid1@chromium.org, Jul 19 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/17f8d5803c39e6a1a94ffb8c4204f61a800600b8

commit 17f8d5803c39e6a1a94ffb8c4204f61a800600b8
Author: Hajime Hoshi <hajimehoshi@chromium.org>
Date: Wed Jul 19 16:30:21 2017

Refactoring: Remove unused argument from GetCPUTypeForProcess

Bug:  742042 
Change-Id: I5ff8f3b7be14be1b79bb43ebd349aded5aa818b9
Reviewed-on: https://chromium-review.googlesource.com/575304
Reviewed-by: danakj <danakj@chromium.org>
Commit-Queue: Hajime Hoshi <hajimehoshi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#487882}
[modify] https://crrev.com/17f8d5803c39e6a1a94ffb8c4204f61a800600b8/base/process/process_metrics_mac.cc

Project Member

Comment 4 by bugdroid1@chromium.org, Jul 19 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/027cedf89e7a639160998d594fdd30205651f661

commit 027cedf89e7a639160998d594fdd30205651f661
Author: Hajime Hoshi <hajimehoshi@chromium.org>
Date: Wed Jul 19 16:33:35 2017

Use mmap instead of base::AlignedAlloc to estimate resident size correctly

base::AlignedAlloc uses memalign, which goes through the malloc zone,
and the result size might be different from the resident size of the
region in Mach virtual memory on macOS.

This CL replaces base::AlignedAlloc usages with mmap to get accurate
resident size.

This is a preparation for  crbug.com/742042  to use mach_vm_region
instead of mincore on macOS for performance.

Bug:  742042 
Change-Id: I2b0dbdfd13ab895645b4d420a91a53a3b5307b6b
Reviewed-on: https://chromium-review.googlesource.com/577494
Reviewed-by: danakj <danakj@chromium.org>
Commit-Queue: Hajime Hoshi <hajimehoshi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#487885}
[modify] https://crrev.com/027cedf89e7a639160998d594fdd30205651f661/base/trace_event/process_memory_dump_unittest.cc

Project Member

Comment 5 by bugdroid1@chromium.org, Jul 24 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/6d4d89ab4573b0e513369c1d089c0ea9aada1239

commit 6d4d89ab4573b0e513369c1d089c0ea9aada1239
Author: Hajime Hoshi <hajimehoshi@chromium.org>
Date: Mon Jul 24 08:44:50 2017

Introduce ProcessMemoryDump::CountResidentBytesInSharedMemory

Now CountResidentBytes uses syscall mincore on POSIX, but on macOS,
mincore is inefficient compared to Mach API like mach_vm_region.

This CL introduces CountResidentBytesInSharedMemory, which is basically
same as COuntResidentBytes with a SharedMemory but uses mach_vm_region
on macOS.

Bug:  742042 
Change-Id: I16685554cf954eb4716750f2d3bbd796faa3bf90
Reviewed-on: https://chromium-review.googlesource.com/575802
Commit-Queue: Hajime Hoshi <hajimehoshi@chromium.org>
Reviewed-by: Erik Chen <erikchen@chromium.org>
Reviewed-by: Primiano Tucci <primiano@chromium.org>
Cr-Commit-Position: refs/heads/master@{#488931}
[modify] https://crrev.com/6d4d89ab4573b0e513369c1d089c0ea9aada1239/base/trace_event/process_memory_dump.cc
[modify] https://crrev.com/6d4d89ab4573b0e513369c1d089c0ea9aada1239/base/trace_event/process_memory_dump.h
[modify] https://crrev.com/6d4d89ab4573b0e513369c1d089c0ea9aada1239/base/trace_event/process_memory_dump_unittest.cc

Status: Fixed (was: Started)

Sign in to add a comment