2017-01-11 10:06:31 +08:00
|
|
|
#ifndef JEMALLOC_INTERNAL_EXTENT_STRUCTS_H
|
|
|
|
#define JEMALLOC_INTERNAL_EXTENT_STRUCTS_H
|
|
|
|
|
2017-04-11 10:04:40 +08:00
|
|
|
#include "jemalloc/internal/atomic.h"
|
2017-04-21 05:32:24 +08:00
|
|
|
#include "jemalloc/internal/bitmap.h"
|
2017-05-24 03:28:19 +08:00
|
|
|
#include "jemalloc/internal/mutex.h"
|
2017-04-11 08:11:33 +08:00
|
|
|
#include "jemalloc/internal/ql.h"
|
2017-04-17 13:31:16 +08:00
|
|
|
#include "jemalloc/internal/ph.h"
|
2017-12-15 04:46:39 +08:00
|
|
|
#include "jemalloc/internal/sc.h"
|
2019-09-21 07:36:42 +08:00
|
|
|
#include "jemalloc/internal/slab_data.h"
|
2017-04-11 07:54:25 +08:00
|
|
|
|
2017-01-30 13:57:14 +08:00
|
|
|
/* Quantized collection of extents, with built-in LRU queue. */
|
|
|
|
struct extents_s {
|
|
|
|
malloc_mutex_t mtx;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Quantized per size class heaps of extents.
|
|
|
|
*
|
|
|
|
* Synchronization: mtx.
|
|
|
|
*/
|
2018-07-20 08:08:10 +08:00
|
|
|
extent_heap_t heaps[SC_NPSIZES + 1];
|
2018-08-01 00:49:49 +08:00
|
|
|
atomic_zu_t nextents[SC_NPSIZES + 1];
|
|
|
|
atomic_zu_t nbytes[SC_NPSIZES + 1];
|
2017-01-30 13:57:14 +08:00
|
|
|
|
2017-03-24 14:45:11 +08:00
|
|
|
/*
|
|
|
|
* Bitmap for which set bits correspond to non-empty heaps.
|
|
|
|
*
|
|
|
|
* Synchronization: mtx.
|
|
|
|
*/
|
2018-07-20 08:08:10 +08:00
|
|
|
bitmap_t bitmap[BITMAP_GROUPS(SC_NPSIZES + 1)];
|
2017-03-24 14:45:11 +08:00
|
|
|
|
2017-01-30 13:57:14 +08:00
|
|
|
/*
|
|
|
|
* LRU of all extents in heaps.
|
|
|
|
*
|
|
|
|
* Synchronization: mtx.
|
|
|
|
*/
|
|
|
|
extent_list_t lru;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Page sum for all extents in heaps.
|
|
|
|
*
|
2017-03-08 09:57:48 +08:00
|
|
|
* The synchronization here is a little tricky. Modifications to npages
|
|
|
|
* must hold mtx, but reads need not (though, a reader who sees npages
|
|
|
|
* without holding the mutex can't assume anything about the rest of the
|
|
|
|
* state of the extents_t).
|
2017-01-30 13:57:14 +08:00
|
|
|
*/
|
2017-03-08 09:57:48 +08:00
|
|
|
atomic_zu_t npages;
|
2017-01-30 13:57:14 +08:00
|
|
|
|
|
|
|
/* All stored extents must be in the same state. */
|
|
|
|
extent_state_t state;
|
2017-02-13 15:18:57 +08:00
|
|
|
|
2017-03-03 10:04:35 +08:00
|
|
|
/*
|
|
|
|
* If true, delay coalescing until eviction; otherwise coalesce during
|
|
|
|
* deallocation.
|
|
|
|
*/
|
|
|
|
bool delay_coalesce;
|
2017-01-30 13:57:14 +08:00
|
|
|
};
|
|
|
|
|
2019-03-16 02:01:45 +08:00
|
|
|
/*
|
|
|
|
* The following two structs are for experimental purposes. See
|
|
|
|
* experimental_utilization_query_ctl and
|
|
|
|
* experimental_utilization_batch_query_ctl in src/ctl.c.
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct extent_util_stats_s {
|
|
|
|
size_t nfree;
|
|
|
|
size_t nregs;
|
|
|
|
size_t size;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct extent_util_stats_verbose_s {
|
|
|
|
void *slabcur_addr;
|
|
|
|
size_t nfree;
|
|
|
|
size_t nregs;
|
|
|
|
size_t size;
|
|
|
|
size_t bin_nfree;
|
|
|
|
size_t bin_nregs;
|
|
|
|
};
|
|
|
|
|
2017-01-11 10:06:31 +08:00
|
|
|
#endif /* JEMALLOC_INTERNAL_EXTENT_STRUCTS_H */
|