| 107 | static MutexSys os_init_mutex; |
| 108 | |
| 109 | __forceinline bool isHugePageCandidate(const size_t bytes) |
| 110 | { |
| 111 | if (!huge_pages_enabled) |
| 112 | return false; |
| 113 | |
| 114 | /* use huge pages only when memory overhead is low */ |
| 115 | const size_t hbytes = (bytes+PAGE_SIZE_2M-1) & ~size_t(PAGE_SIZE_2M-1); |
| 116 | return 66*(hbytes-bytes) < bytes; // at most 1.5% overhead |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | //////////////////////////////////////////////////////////////////////////////// |