Home | History | Annotate | Line # | Download | only in internal
      1 #ifndef JEMALLOC_INTERNAL_HPA_CENTRAL_H
      2 #define JEMALLOC_INTERNAL_HPA_CENTRAL_H
      3 
      4 #include "jemalloc/internal/jemalloc_preamble.h"
      5 #include "jemalloc/internal/base.h"
      6 #include "jemalloc/internal/hpa_hooks.h"
      7 #include "jemalloc/internal/hpdata.h"
      8 #include "jemalloc/internal/mutex.h"
      9 #include "jemalloc/internal/tsd_types.h"
     10 
     11 typedef struct hpa_central_s hpa_central_t;
     12 struct hpa_central_s {
     13 	/*
     14 	 * Guards expansion of eden.  We separate this from the regular mutex so
     15 	 * that cheaper operations can still continue while we're doing the OS
     16 	 * call.
     17 	 */
     18 	malloc_mutex_t grow_mtx;
     19 	/*
     20 	 * Either NULL (if empty), or some integer multiple of a
     21 	 * hugepage-aligned number of hugepages.  We carve them off one at a
     22 	 * time to satisfy new pageslab requests.
     23 	 *
     24 	 * Guarded by grow_mtx.
     25 	 */
     26 	void  *eden;
     27 	size_t eden_len;
     28 	/* Source for metadata. */
     29 	base_t *base;
     30 
     31 	/* The HPA hooks. */
     32 	hpa_hooks_t hooks;
     33 };
     34 
     35 bool hpa_central_init(
     36     hpa_central_t *central, base_t *base, const hpa_hooks_t *hooks);
     37 
     38 hpdata_t *hpa_central_extract(tsdn_t *tsdn, hpa_central_t *central, size_t size,
     39     uint64_t age, bool hugify_eager, bool *oom);
     40 
     41 #endif /* JEMALLOC_INTERNAL_HPA_CENTRAL_H */
     42