Blame jemalloc/include/jemalloc/internal/base_structs.h
|
Packit |
345191 |
#ifndef JEMALLOC_INTERNAL_BASE_STRUCTS_H
|
|
Packit |
345191 |
#define JEMALLOC_INTERNAL_BASE_STRUCTS_H
|
|
Packit |
345191 |
|
|
Packit |
345191 |
#include "jemalloc/internal/jemalloc_internal_types.h"
|
|
Packit |
345191 |
#include "jemalloc/internal/mutex.h"
|
|
Packit |
345191 |
#include "jemalloc/internal/sc.h"
|
|
Packit |
345191 |
|
|
Packit |
345191 |
/* Embedded at the beginning of every block of base-managed virtual memory. */
|
|
Packit |
345191 |
struct base_block_s {
|
|
Packit |
345191 |
/* Total size of block's virtual memory mapping. */
|
|
Packit |
345191 |
size_t size;
|
|
Packit |
345191 |
|
|
Packit |
345191 |
/* Next block in list of base's blocks. */
|
|
Packit |
345191 |
base_block_t *next;
|
|
Packit |
345191 |
|
|
Packit |
345191 |
/* Tracks unused trailing space. */
|
|
Packit |
345191 |
extent_t extent;
|
|
Packit |
345191 |
};
|
|
Packit |
345191 |
|
|
Packit |
345191 |
struct base_s {
|
|
Packit |
345191 |
/* Associated arena's index within the arenas array. */
|
|
Packit |
345191 |
unsigned ind;
|
|
Packit |
345191 |
|
|
Packit |
345191 |
/*
|
|
Packit |
345191 |
* User-configurable extent hook functions. Points to an
|
|
Packit |
345191 |
* extent_hooks_t.
|
|
Packit |
345191 |
*/
|
|
Packit |
345191 |
atomic_p_t extent_hooks;
|
|
Packit |
345191 |
|
|
Packit |
345191 |
/* Protects base_alloc() and base_stats_get() operations. */
|
|
Packit |
345191 |
malloc_mutex_t mtx;
|
|
Packit |
345191 |
|
|
Packit |
345191 |
/* Using THP when true (metadata_thp auto mode). */
|
|
Packit |
345191 |
bool auto_thp_switched;
|
|
Packit |
345191 |
/*
|
|
Packit |
345191 |
* Most recent size class in the series of increasingly large base
|
|
Packit |
345191 |
* extents. Logarithmic spacing between subsequent allocations ensures
|
|
Packit |
345191 |
* that the total number of distinct mappings remains small.
|
|
Packit |
345191 |
*/
|
|
Packit |
345191 |
pszind_t pind_last;
|
|
Packit |
345191 |
|
|
Packit |
345191 |
/* Serial number generation state. */
|
|
Packit |
345191 |
size_t extent_sn_next;
|
|
Packit |
345191 |
|
|
Packit |
345191 |
/* Chain of all blocks associated with base. */
|
|
Packit |
345191 |
base_block_t *blocks;
|
|
Packit |
345191 |
|
|
Packit |
345191 |
/* Heap of extents that track unused trailing space within blocks. */
|
|
Packit |
345191 |
extent_heap_t avail[SC_NSIZES];
|
|
Packit |
345191 |
|
|
Packit |
345191 |
/* Stats, only maintained if config_stats. */
|
|
Packit |
345191 |
size_t allocated;
|
|
Packit |
345191 |
size_t resident;
|
|
Packit |
345191 |
size_t mapped;
|
|
Packit |
345191 |
/* Number of THP regions touched. */
|
|
Packit |
345191 |
size_t n_thp;
|
|
Packit |
345191 |
};
|
|
Packit |
345191 |
|
|
Packit |
345191 |
#endif /* JEMALLOC_INTERNAL_BASE_STRUCTS_H */
|