OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // Author: Ken Chen <kenchen@google.com> | 4 // Author: Ken Chen <kenchen@google.com> |
5 // | 5 // |
6 // hugepage text library to remap process executable segment with hugepages. | 6 // hugepage text library to remap process executable segment with hugepages. |
7 | 7 |
8 #include "chromeos/hugepage_text/hugepage_text.h" | 8 #include "chromeos/hugepage_text/hugepage_text.h" |
9 | 9 |
10 #include <link.h> | 10 #include <link.h> |
11 #include <sys/mman.h> | 11 #include <sys/mman.h> |
12 | 12 |
| 13 #include "base/bit_cast.h" |
13 #include "base/logging.h" | 14 #include "base/logging.h" |
14 | 15 |
15 namespace chromeos { | 16 namespace chromeos { |
16 | 17 |
17 #ifndef MAP_HUGETLB | 18 #ifndef MAP_HUGETLB |
18 #define MAP_HUGETLB 0x40000 | 19 #define MAP_HUGETLB 0x40000 |
19 #endif | 20 #endif |
20 | 21 |
21 #ifndef TMPFS_MAGIC | 22 #ifndef TMPFS_MAGIC |
22 #define TMPFS_MAGIC 0x01021994 | 23 #define TMPFS_MAGIC 0x01021994 |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 | 212 |
212 // Main library function. This function will iterate all ELF segments and | 213 // Main library function. This function will iterate all ELF segments and |
213 // attempt to remap text segment from small page to hugepage. | 214 // attempt to remap text segment from small page to hugepage. |
214 // If remapping is successful. All error conditions are soft fail such that | 215 // If remapping is successful. All error conditions are soft fail such that |
215 // effect will be rolled back and remap operation will be aborted. | 216 // effect will be rolled back and remap operation will be aborted. |
216 void ReloadElfTextInHugePages(void) { | 217 void ReloadElfTextInHugePages(void) { |
217 dl_iterate_phdr(FilterElfHeader, 0); | 218 dl_iterate_phdr(FilterElfHeader, 0); |
218 } | 219 } |
219 | 220 |
220 } // namespace chromeos | 221 } // namespace chromeos |
OLD | NEW |