Commit 0319eb27 authored by Wez's avatar Wez Committed by Commit Bot

[base] Don't try to decommit pages if they're about to be unmapped.

DiscardableSharedMemory::Purge() attempts to proactively discard pages
to prevent slow-to-respond clients from keeping the pages live longer.

If the instance is in-process then these kernel calls are unnecessary
since the memory is about to be unmapped anyway.

Bug: 1023693
Change-Id: I2bc19eb64f3fdc009c5bf8c4ed6369b2b5081045
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1911487
Auto-Submit: Wez <wez@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Commit-Queue: Wez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#714684}
parent 29af0f68
......@@ -368,6 +368,15 @@ bool DiscardableSharedMemory::Purge(Time current_time) {
return false;
}
// If |shared_memory_region_| handle is invalid then the memory will be
// released by the manager Unmap()ping |this| in response to Purge() returning
// true, so there is no point spending time calling discard APIs.
// This is the case for in-process instances.
if (!shared_memory_region_.IsValid()) {
last_known_usage_ = Time();
return true;
}
// The next section will release as much resource as can be done
// from the purging process, until the client process notices the
// purge and releases its own references.
......
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