31#ifndef detail_ut_large_page_alloc_h
32#define detail_ut_large_page_alloc_h
40#elif defined(__APPLE__)
112 static inline void *
alloc(std::size_t size) {
129 static inline bool free(
void *data)
noexcept {
175 static inline void *
deduce(
void *data)
noexcept {
177 const auto res =
reinterpret_cast<void *
>(
static_cast<uint8_t *
>(data) -
255#ifdef HAVE_PSI_MEMORY_INTERFACE
286#ifdef HAVE_PSI_MEMORY_INTERFACE
294 (
key, total_len, owner);
353template <
bool Pfs_memory_instrumentation_on>
365template <
bool Pfs_memory_instrumentation_on>
372template <
typename Impl>
374 template <
typename T = Impl>
377 return Impl::alloc(size,
key);
379 template <
typename T = Impl>
382 return Impl::alloc(size);
385 static inline size_t datalen(
void *ptr) {
return Impl::datalen(ptr); }
388 return Impl::low_level_info(ptr);
#define PSI_MEMORY_CALL(M)
Definition: psi_memory.h:36
unsigned int PSI_memory_key
Instrumented memory key.
Definition: psi_memory_bits.h:49
Linux-specific implementation bits and pieces for large (huge) page allocations.
OSX-specific implementation bits and pieces for large (huge) page allocations.
Solaris-specific implementation bits and pieces for large (huge) page allocations.
Windows-specific implementation bits and pieces for large (huge) page allocations.
const size_t large_page_default_size
System-default huge (large) page setting.
Definition: ut0new.cc:40
#define free(A)
Definition: lexyy.cc:915
Header for compiler-dependent features.
constexpr bool unlikely(bool expr)
Definition: my_compiler.h:56
Definition: ut0tuple.h:57
static PSI_memory_key memory_alloc(PSI_memory_key, size_t, struct PSI_thread **owner)
Definition: psi_memory_v2_empty.cc:35
static void memory_free(PSI_memory_key, size_t, struct PSI_thread *)
Definition: psi_memory_v2_empty.cc:53
void * large_page_aligned_alloc(size_t n_bytes)
Allocates memory backed by large (huge) pages.
Definition: large_page_alloc-linux.h:52
Page_type
Types of pages currently supported by ut:: library functions.
Definition: page_metadata.h:43
typename select_large_page_alloc_impl< Pfs_memory_instrumentation_on >::type select_large_page_alloc_impl_t
Just a small helper type which saves us some keystrokes.
Definition: large_page_alloc.h:367
constexpr size_t round_to_next_multiple(size_t n, size_t m)
Calculates the next multiple of m that is bigger or equal to n.
Definition: helper.h:68
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
Implementation bits and pieces for metadata for normal and large (huge) page allocations.
required string key
Definition: replication_asynchronous_connection_failover.proto:60
required string type
Definition: replication_group_member_actions.proto:34
static MEM_ROOT mem
Definition: sql_servers.cc:99
Implementation bits and pieces for PFS metadata handling.
Can be used to extract pointer and size of the allocation provided by the OS.
Definition: ut0new.h:140
Small wrapper which utilizes SFINAE to dispatch the call to appropriate aligned allocator implementat...
Definition: large_page_alloc.h:373
static bool free(void *ptr)
Definition: large_page_alloc.h:384
static std::enable_if<!T::is_pfs_instrumented_v, void * >::type alloc(size_t size, PSI_memory_key)
Definition: large_page_alloc.h:381
static Page_type page_type(void *ptr)
Definition: large_page_alloc.h:386
static std::enable_if< T::is_pfs_instrumented_v, void * >::type alloc(size_t size, PSI_memory_key key)
Definition: large_page_alloc.h:376
static size_t datalen(void *ptr)
Definition: large_page_alloc.h:385
static allocation_low_level_info low_level_info(void *ptr)
Definition: large_page_alloc.h:387
Allocation routines which are purposed for allocating memory through the means of what is known as la...
Definition: large_page_alloc.h:238
static allocation_low_level_info low_level_info(void *data)
Retrieves the pointer and size of the allocation provided by the OS.
Definition: large_page_alloc.h:330
static void * deduce(PFS_metadata::data_segment_ptr data) noexcept
Helper function which deduces the original pointer returned by Large_page_alloc_pfs from a pointer wh...
Definition: large_page_alloc.h:341
static void * alloc(std::size_t size, page_allocation_metadata::pfs_metadata::pfs_memory_key_t key)
Allocates memory through large-page support.
Definition: large_page_alloc.h:247
static size_t datalen(PFS_metadata::data_segment_ptr data)
Returns the number of bytes that have been allocated.
Definition: large_page_alloc.h:306
static Page_type page_type(PFS_metadata::data_segment_ptr data)
Returns the Page_type.
Definition: large_page_alloc.h:318
static bool free(PFS_metadata::data_segment_ptr data) noexcept
Releases storage allocated through Large_page_alloc_pfs::alloc().
Definition: large_page_alloc.h:281
Allocation routines which are purposed for allocating memory through the means of what is known as la...
Definition: large_page_alloc.h:104
static bool free(void *data) noexcept
Releases storage allocated through Large_page_alloc::alloc().
Definition: large_page_alloc.h:129
static void * deduce(void *data) noexcept
Helper function which deduces the original pointer returned by Large_page_alloc from a pointer which ...
Definition: large_page_alloc.h:175
static void * alloc(std::size_t size)
Allocates memory through large-page support.
Definition: large_page_alloc.h:112
static Page_type page_type(void *data)
Returns the type of the page.
Definition: large_page_alloc.h:154
static page_allocation_metadata::datalen_t datalen(void *data)
Returns the number of bytes that have been allocated.
Definition: large_page_alloc.h:142
static allocation_low_level_info low_level_info(void *data)
Retrieves the pointer and size of the allocation provided by the OS.
Definition: large_page_alloc.h:166
Helper struct implementing the type which represents the metadata for all types of PFS-aware page-ali...
Definition: page_metadata.h:198
static constexpr auto len
This is how much this metadata segment will be big.
Definition: page_metadata.h:203
static Page_type page_type(void *data)
Sanity check so that we can be sure that the size of our metadata segment is such so that the pointer...
Definition: page_metadata.h:221
Helper struct implementing the type which represents the metadata for all types of page-aligned alloc...
Definition: page_metadata.h:75
static constexpr auto len
This is how much tise metadata segment will be big.
Definition: page_metadata.h:77
static Page_type page_type(void *data)
Accessor to the page_type_t field.
Definition: page_metadata.h:110
static datalen_t datalen(void *data)
Sanity check so that we can be sure that the size of our metadata segment is such so that the next se...
Definition: page_metadata.h:101
size_t datalen_t
These are the types representing our memory fields.
Definition: page_metadata.h:80
Simple allocator traits.
Definition: allocator_traits.h:82
Simple utility metafunction which selects appropriate allocator variant (implementation) depending on...
Definition: large_page_alloc.h:354
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:69