Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(692)

Unified Diff: base/allocator/partition_allocator/page_allocator.h

Issue 2942233002: Add some support for promptly purging pages.
Patch Set: add MADV_FREE fallback Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/allocator/partition_allocator/page_allocator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/allocator/partition_allocator/page_allocator.h
diff --git a/base/allocator/partition_allocator/page_allocator.h b/base/allocator/partition_allocator/page_allocator.h
index f57beb7b37fca257b6a77b8675151fa55659c232..b5e3d0265a86aa7276b6f9a5e7d8becf34c3b576 100644
--- a/base/allocator/partition_allocator/page_allocator.h
+++ b/base/allocator/partition_allocator/page_allocator.h
@@ -75,15 +75,24 @@ BASE_EXPORT WARN_UNUSED_RESULT bool SetSystemPagesAccessible(void* address,
// Decommit one or more system pages. Decommitted means that the physical memory
// is released to the system, but the virtual address space remains reserved.
-// System pages are re-committed by calling recommitSystemPages(). Touching
+// System pages are re-committed by calling RecommitSystemPages(). Touching
// a decommitted page _may_ fault.
// Clients should not make any assumptions about the contents of decommitted
// system pages, before or after they write to the page. The only guarantee
// provided is that the contents of the system page will be deterministic again
// after recommitting and writing to it. In particlar note that system pages are
-// not guaranteed to be zero-filled upon re-commit. len must be a multiple of
-// kSystemPageSize bytes.
-BASE_EXPORT void DecommitSystemPages(void* address, size_t length);
+// not guaranteed to be zero-filled upon re-commit. |len| must be a multiple of
+// |kSystemPageSize| bytes.
+//
+// |purge_hint| is an optional hint to signal that the system pages can
+// be discarded from process memory right away. By supplying |true|, the
+// implementation makes an OS-specific best effort to decommit the system pages
+// sooner from the process. Even with |purge_hint| set to |true|, it is not
+// guaranteed that the decommitted system pages will be zero-filled upon
+// recommit.
+BASE_EXPORT void DecommitSystemPages(void* address,
+ size_t length,
+ bool purge_hint = false);
// Recommit one or more system pages. Decommitted system pages must be
// recommitted before they are read are written again.
« no previous file with comments | « no previous file | base/allocator/partition_allocator/page_allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698