Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 100 // after recommitting and writing to it. In particlar note that system pages are // not guaranteed to be zero-filled upon re-commit. | 100 // after recommitting and writing to it. In particlar note that system pages are // not guaranteed to be zero-filled upon re-commit. |
| 101 // len must be a multiple of kSystemPageSize bytes. | 101 // len must be a multiple of kSystemPageSize bytes. |
| 102 WTF_EXPORT void decommitSystemPages(void* addr, size_t len); | 102 WTF_EXPORT void decommitSystemPages(void* addr, size_t len); |
| 103 | 103 |
| 104 // Recommit one or more system pages. Decommitted system pages must be | 104 // Recommit one or more system pages. Decommitted system pages must be |
| 105 // recommitted before they are read are written again. | 105 // recommitted before they are read are written again. |
| 106 // Note that this operation may be a no-op on some platforms. | 106 // Note that this operation may be a no-op on some platforms. |
| 107 // len must be a multiple of kSystemPageSize bytes. | 107 // len must be a multiple of kSystemPageSize bytes. |
| 108 WTF_EXPORT void recommitSystemPages(void* addr, size_t len); | 108 WTF_EXPORT void recommitSystemPages(void* addr, size_t len); |
| 109 | 109 |
| 110 // Discard one or more system pages. Discarding is a hint to the system that | |
| 111 // the page is no longer required. The hint may: | |
| 112 // - Do nothing. | |
| 113 // - Discard the page immediately, freeing up physical pages. | |
| 114 // - Discard the page at some time in the future in response to memory pressure. | |
| 115 // Only committed pages should be discarded. Discarding a page does not | |
| 116 // decommit it, and it is valid to discard an already-discarded page. | |
|
haraken
2015/06/18 18:15:40
I'm a bit confused with "Discarding a page does no
| |
| 117 // A read or write to a discarded page will not fault. | |
|
haraken
2015/06/18 18:15:40
Given that you call decommitSystemPages, I guess a
| |
| 118 // Reading from a discarded page may return the original page content, or a | |
| 119 // page full of zeroes. | |
| 120 // Writing to a discarded page is the only guaranteed way to undo the effect of | |
|
haraken
2015/06/18 18:15:40
"undo the effect of discarding it" might be a bit
| |
| 121 // discarding it. Once written to, the content of the page is guaranteed stable | |
| 122 // again. After being written to, the page content may be based on the original | |
| 123 // page content, or a page of zeroes. | |
| 124 // len must be a multiple of kSystemPageSize bytes. | |
| 125 WTF_EXPORT void discardSystemPages(void* addr, size_t len); | |
| 126 | |
| 110 } // namespace WTF | 127 } // namespace WTF |
| 111 | 128 |
| 112 #endif // WTF_PageAllocator_h | 129 #endif // WTF_PageAllocator_h |
| OLD | NEW |