Home | History | Annotate | Download | only in internal
      1 #ifndef JEMALLOC_INTERNAL_BASE_TYPES_H
      2 #define JEMALLOC_INTERNAL_BASE_TYPES_H
      3 
      4 typedef struct base_block_s base_block_t;
      5 typedef struct base_s base_t;
      6 
      7 #define METADATA_THP_DEFAULT metadata_thp_disabled
      8 
      9 /*
     10  * In auto mode, arenas switch to huge pages for the base allocator on the
     11  * second base block.  a0 switches to thp on the 5th block (after 20 megabytes
     12  * of metadata), since more metadata (e.g. rtree nodes) come from a0's base.
     13  */
     14 
     15 #define BASE_AUTO_THP_THRESHOLD    2
     16 #define BASE_AUTO_THP_THRESHOLD_A0 5
     17 
     18 typedef enum {
     19 	metadata_thp_disabled   = 0,
     20 	/*
     21 	 * Lazily enable hugepage for metadata. To avoid high RSS caused by THP
     22 	 * + low usage arena (i.e. THP becomes a significant percentage), the
     23 	 * "auto" option only starts using THP after a base allocator used up
     24 	 * the first THP region.  Starting from the second hugepage (in a single
     25 	 * arena), "auto" behaves the same as "always", i.e. madvise hugepage
     26 	 * right away.
     27 	 */
     28 	metadata_thp_auto       = 1,
     29 	metadata_thp_always     = 2,
     30 	metadata_thp_mode_limit = 3
     31 } metadata_thp_mode_t;
     32 
     33 #endif /* JEMALLOC_INTERNAL_BASE_TYPES_H */
     34