Commit f3acd395 authored by erikchen's avatar erikchen Committed by Commit Bot

Update accounting on macOS for recommitted pages in partition alloc.

The syscall madvise(MADV_FREE_REUSE) is used to update accounting for
memory-usage, and is intended to be paired with madvise(MADV_FREE_REUSABLE).

Bug: 823915
Change-Id: Iedbeebf58c1c8dd85ce25615d0ddcfc5eb1d4afb
Reviewed-on: https://chromium-review.googlesource.com/988194Reviewed-by: default avatarChris Palmer <palmer@chromium.org>
Commit-Queue: Erik Chen <erikchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#547538}
parent 869d4ca5
......@@ -149,6 +149,12 @@ void DecommitSystemPagesInternal(void* address, size_t length) {
bool RecommitSystemPagesInternal(void* address,
size_t length,
PageAccessibilityConfiguration accessibility) {
#if defined(OS_MACOSX)
// On macOS, to update accounting, we need to make another syscall. For more
// details, see https://crbug.com/823915.
madvise(address, length, MADV_FREE_REUSE);
#endif
// On POSIX systems, the caller need simply read the memory to recommit it.
// This has the correct behavior because the API requires the permissions to
// be the same as before decommitting and all configurations can read.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment