Add PAC: Page allocator classic.
For now, this is just a stub containing the ecaches, with no surrounding code changed. Eventually all the core allocator bits will be moved in, in the subsequent stack of commits.
This commit is contained in:
committed by
David Goldblatt
parent
1b5f632e0f
commit
777b0ba965
@@ -7,8 +7,17 @@
|
||||
#include "jemalloc/internal/edata_cache.h"
|
||||
#include "jemalloc/internal/emap.h"
|
||||
#include "jemalloc/internal/lockedint.h"
|
||||
#include "jemalloc/internal/pac.h"
|
||||
#include "jemalloc/internal/pai.h"
|
||||
|
||||
/*
|
||||
* The page allocator; responsible for acquiring pages of memory for
|
||||
* allocations. It picks the implementation of the page allocator interface
|
||||
* (i.e. a pai_t) to handle a given page-level allocation request. For now, the
|
||||
* only such implementation is the PAC code ("page allocator classic"), but
|
||||
* others will be coming soon.
|
||||
*/
|
||||
|
||||
enum pa_decay_purge_setting_e {
|
||||
PA_DECAY_PURGE_ALWAYS,
|
||||
PA_DECAY_PURGE_NEVER,
|
||||
@@ -16,11 +25,6 @@ enum pa_decay_purge_setting_e {
|
||||
};
|
||||
typedef enum pa_decay_purge_setting_e pa_decay_purge_setting_t;
|
||||
|
||||
/*
|
||||
* The page allocator; responsible for acquiring pages of memory for
|
||||
* allocations.
|
||||
*/
|
||||
|
||||
typedef struct pa_shard_decay_stats_s pa_shard_decay_stats_t;
|
||||
struct pa_shard_decay_stats_s {
|
||||
/* Total number of purge sweeps. */
|
||||
@@ -117,16 +121,7 @@ struct pa_shard_s {
|
||||
* this is the *only* pai, but we'll soon grow another.
|
||||
*/
|
||||
pai_t ecache_pai;
|
||||
|
||||
/*
|
||||
* Collections of extents that were previously allocated. These are
|
||||
* used when allocating extents, in an attempt to re-use address space.
|
||||
*
|
||||
* Synchronization: internal.
|
||||
*/
|
||||
ecache_t ecache_dirty;
|
||||
ecache_t ecache_muzzy;
|
||||
ecache_t ecache_retained;
|
||||
pac_t pac;
|
||||
|
||||
/* The source of edata_t objects. */
|
||||
edata_cache_t edata_cache;
|
||||
@@ -167,7 +162,7 @@ pa_shard_muzzy_decay_ms_get(pa_shard_t *shard) {
|
||||
|
||||
static inline bool
|
||||
pa_shard_dont_decay_muzzy(pa_shard_t *shard) {
|
||||
return ecache_npages_get(&shard->ecache_muzzy) == 0 &&
|
||||
return ecache_npages_get(&shard->pac.ecache_muzzy) == 0 &&
|
||||
pa_shard_muzzy_decay_ms_get(shard) <= 0;
|
||||
}
|
||||
|
||||
|
25
include/jemalloc/internal/pac.h
Normal file
25
include/jemalloc/internal/pac.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef JEMALLOC_INTERNAL_PAC_H
|
||||
#define JEMALLOC_INTERNAL_PAC_H
|
||||
|
||||
/*
|
||||
* Page allocator classic; an implementation of the PAI interface that:
|
||||
* - Can be used for arenas with custom extent hooks.
|
||||
* - Can always satisfy any allocation request (including highly-fragmentary
|
||||
* ones).
|
||||
* - Can use efficient OS-level zeroing primitives for demand-filled pages.
|
||||
*/
|
||||
|
||||
typedef struct pac_s pac_t;
|
||||
struct pac_s {
|
||||
/*
|
||||
* Collections of extents that were previously allocated. These are
|
||||
* used when allocating extents, in an attempt to re-use address space.
|
||||
*
|
||||
* Synchronization: internal.
|
||||
*/
|
||||
ecache_t ecache_dirty;
|
||||
ecache_t ecache_muzzy;
|
||||
ecache_t ecache_retained;
|
||||
};
|
||||
|
||||
#endif /* JEMALLOC_INTERNAL_PAC_H */
|
Reference in New Issue
Block a user