forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PageAllocator: Fix DecommitSystemPages() semantics
Prior to this CL, DecommitSystemPages() performed 2 conceptually different operations that callers cared about depending on which platorm it was called on. There are 2 operations: * return storage from ram or swap to the OS * make the page inaccessible. On Windows, "Committed memory" is a first-class concept in the OS Memory Subsystem API. A region returned via VirtualAlloc() when MEM_COMMIT is specified is guaranteed to be touchable without causing the program to crash due to out of memory. Since it is a first class concept, decommitting is directly supported and calling this function resulted in the both operations above. In the POSIX memory API, there is no such thing as "Committed memory." Until the first touch of an anonymous mmap()ed region, it is unknown if the pointer deference for that address may crash. Therefore this API had unclear semantics and was implemented to ONLY return allocated ram and swap to the OS. Page permissions were left the same meaning subsequent touches would just reallocate the memory instead of fault. This divergence in page accessibility caused callers to manually execute SetSystemPagesAccess() after calling DecommitSystemPages() to ensure uniform behavior across all platforms which resulted in a wasted syscall on Windows and confusing API semantics. This CL changes the contract of DecommitSystemPages() so that it provides the guarnatees that can be enforced on all platforms. The naming is still somewhat incorrect as "commit" is not a well defined concept in POSIX...baby steps... Bug: 766882 Change-Id: Ib5c8f1c712e080f1003fad628f60012e0feaf9d8 Reviewed-on: https://chromium-review.googlesource.com/696292 Commit-Queue: Albert J. Wong <ajwong@chromium.org> Reviewed-by: Kentaro Hara <haraken@chromium.org> Reviewed-by: Albert J. Wong <ajwong@chromium.org> Reviewed-by: Chris Palmer <palmer@chromium.org> Cr-Commit-Position: refs/heads/master@{#509309}
- Loading branch information
1 parent
49bd837
commit 8a24491
Showing
4 changed files
with
40 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters