32#ifndef detail_ut_large_page_alloc_linux_h 
   33#define detail_ut_large_page_alloc_linux_h 
   38#include "mysqld_error.h" 
   55  int mmap_flags = MAP_PRIVATE | MAP_ANON;
 
   57  mmap_flags |= MAP_HUGETLB;
 
   59  void *ptr = mmap(
nullptr, n_bytes, PROT_READ | PROT_WRITE, mmap_flags, -1, 0);
 
   61    ib::log_warn(ER_IB_MSG_856) << 
"large_page_aligned_alloc mmap(" << n_bytes
 
   66  return (ptr != (
void *)-1) ? ptr : 
nullptr;
 
   80  auto ret = munmap(ptr, n_bytes_rounded);
 
   83        << 
"large_page_aligned_free munmap(" << ptr << 
", " << n_bytes_rounded
 
   97  std::ifstream meminfo(
"/proc/meminfo");
 
   99    while (meminfo >> 
key) {
 
  100      if (
key == 
"Hugepagesize:") {
 
  101        unsigned long long value;
 
  103        if (
value == 0 && meminfo.fail()) 
return 0;
 
const size_t large_page_default_size
System-default huge (large) page setting.
Definition: ut0new.cc:40
 
constexpr bool unlikely(bool expr)
Definition: my_compiler.h:58
 
Definition: fts0fts.cc:237
 
static auto log_warn()
Definition: ut0log.h:452
 
static auto log_error()
Definition: ut0log.h:453
 
ValueType value(const std::optional< ValueType > &v)
Definition: gtid.h:83
 
ValueType max(X &&first)
Definition: gtid.h:103
 
constexpr size_t pow2_round(size_t n, size_t m)
Calculates the biggest multiple of m that is not bigger than n when m is a power of two.
Definition: helper.h:57
 
void * large_page_aligned_alloc(size_t n_bytes)
Allocates memory backed by large (huge) pages.
Definition: large_page_alloc-linux.h:52
 
bool large_page_aligned_free(void *ptr, size_t n_bytes)
Releases memory backed by large (huge) pages.
Definition: large_page_alloc-linux.h:75
 
size_t large_page_size()
Queries the current size of large (huge) pages on running system.
Definition: large_page_alloc-linux.h:95
 
This file contains a set of libraries providing overloads for regular dynamic allocation routines whi...
Definition: aligned_alloc.h:48
 
required string key
Definition: replication_asynchronous_connection_failover.proto:60
 
Base of InnoDB utilities.