mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-22 12:24:34 +00:00
This change includes the following improvements: - Remove the hpa_sec_batch_fill_extra parameter. - Refactor the hpa_alloc() code and helper functions to be able to allocate more than one extent out of a single pageslab. This way we can amortize the per-pageslab costs (active bitmap iteration, pageslab metadata updates) across multiple extents. - Decide on a min and max number of extents that will be allocated in hpa_alloc(). The code will try to allocate at least the min and allocate up to the max as long as we can allocate additional ones from the pageslab we already have, as additional allocations are relatively cheap. - Add extent allocation distribution stats. - Amend hpa_sec_integration.c unit test.
44 lines
1.4 KiB
C
44 lines
1.4 KiB
C
#ifndef JEMALLOC_INTERNAL_SEC_OPTS_H
|
|
#define JEMALLOC_INTERNAL_SEC_OPTS_H
|
|
|
|
#include "jemalloc/internal/jemalloc_preamble.h"
|
|
|
|
/*
|
|
* The configuration settings used by an sec_t. Morally, this is part of the
|
|
* SEC interface, but we put it here for header-ordering reasons.
|
|
*/
|
|
|
|
typedef struct sec_opts_s sec_opts_t;
|
|
struct sec_opts_s {
|
|
/*
|
|
* We don't necessarily always use all the shards; requests are
|
|
* distributed across shards [0, nshards - 1). Once thread picks a
|
|
* shard it will always use that one. If this value is set to 0 sec is
|
|
* not used.
|
|
*/
|
|
size_t nshards;
|
|
/*
|
|
* We'll automatically refuse to cache any objects in this sec if
|
|
* they're larger than max_alloc bytes.
|
|
*/
|
|
size_t max_alloc;
|
|
/*
|
|
* Exceeding this amount of cached extents in a bin causes us to flush
|
|
* until we are 1/4 below max_bytes.
|
|
*/
|
|
size_t max_bytes;
|
|
};
|
|
|
|
#define SEC_OPTS_NSHARDS_DEFAULT 2
|
|
#define SEC_OPTS_MAX_ALLOC_DEFAULT ((32 * 1024) < PAGE ? PAGE : (32 * 1024))
|
|
#define SEC_OPTS_MAX_BYTES_DEFAULT \
|
|
((256 * 1024) < (4 * SEC_OPTS_MAX_ALLOC_DEFAULT) \
|
|
? (4 * SEC_OPTS_MAX_ALLOC_DEFAULT) \
|
|
: (256 * 1024))
|
|
|
|
#define SEC_OPTS_DEFAULT \
|
|
{SEC_OPTS_NSHARDS_DEFAULT, SEC_OPTS_MAX_ALLOC_DEFAULT, \
|
|
SEC_OPTS_MAX_BYTES_DEFAULT}
|
|
|
|
#endif /* JEMALLOC_INTERNAL_SEC_OPTS_H */
|