forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hugepage_text.h
38 lines (31 loc) · 1.26 KB
/
hugepage_text.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Author: Ken Chen <kenchen@google.com>
//
// Library support to remap process executable elf segment with hugepages.
//
// InitHugepagesAndMlockSelf() will search for an ELF executable segment,
// and remap it using hugepage.
#ifndef CHROMEOS_HUGEPAGE_TEXT_HUGEPAGE_TEXT_H_
#define CHROMEOS_HUGEPAGE_TEXT_HUGEPAGE_TEXT_H_
#include <string>
#include "chromeos/chromeos_export.h"
#if defined(__clang__) || defined(__GNUC__)
#define ATTRIBUTE_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address))
#else
#define ATTRIBUTE_NO_SANITIZE_ADDRESS
#endif
namespace chromeos {
// This function will scan ELF segments and attempt to do two things:
// - Reload some of .text into hugepages
// - Lock some of .text into memory, so it can't be swapped out.
//
// When this function returns, text segments that are naturally aligned on
// hugepage size will be backed by hugepages.
//
// Any and all errors encountered by this function are soft errors; Chrome
// should still be able to run.
CHROMEOS_EXPORT extern void InitHugepagesAndMlockSelf(void);
} // namespace chromeos
#endif // CHROMEOS_HUGEPAGE_TEXT_HUGEPAGE_TEXT_H_