hpa_opts.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #ifndef JEMALLOC_INTERNAL_HPA_OPTS_H
  2. #define JEMALLOC_INTERNAL_HPA_OPTS_H
  3. #include "jemalloc/internal/fxp.h"
  4. /*
  5. * This file is morally part of hpa.h, but is split out for header-ordering
  6. * reasons.
  7. */
  8. typedef struct hpa_shard_opts_s hpa_shard_opts_t;
  9. struct hpa_shard_opts_s {
  10. /*
  11. * The largest size we'll allocate out of the shard. For those
  12. * allocations refused, the caller (in practice, the PA module) will
  13. * fall back to the more general (for now) PAC, which can always handle
  14. * any allocation request.
  15. */
  16. size_t slab_max_alloc;
  17. /*
  18. * When the number of active bytes in a hugepage is >=
  19. * hugification_threshold, we force hugify it.
  20. */
  21. size_t hugification_threshold;
  22. /*
  23. * The HPA purges whenever the number of pages exceeds dirty_mult *
  24. * active_pages. This may be set to (fxp_t)-1 to disable purging.
  25. */
  26. fxp_t dirty_mult;
  27. /*
  28. * Whether or not the PAI methods are allowed to defer work to a
  29. * subsequent hpa_shard_do_deferred_work() call. Practically, this
  30. * corresponds to background threads being enabled. We track this
  31. * ourselves for encapsulation purposes.
  32. */
  33. bool deferral_allowed;
  34. /*
  35. * How long a hugepage has to be a hugification candidate before it will
  36. * actually get hugified.
  37. */
  38. uint64_t hugify_delay_ms;
  39. /*
  40. * Minimum amount of time between purges.
  41. */
  42. uint64_t min_purge_interval_ms;
  43. };
  44. #define HPA_SHARD_OPTS_DEFAULT { \
  45. /* slab_max_alloc */ \
  46. 64 * 1024, \
  47. /* hugification_threshold */ \
  48. HUGEPAGE * 95 / 100, \
  49. /* dirty_mult */ \
  50. FXP_INIT_PERCENT(25), \
  51. /* \
  52. * deferral_allowed \
  53. * \
  54. * Really, this is always set by the arena during creation \
  55. * or by an hpa_shard_set_deferral_allowed call, so the value \
  56. * we put here doesn't matter. \
  57. */ \
  58. false, \
  59. /* hugify_delay_ms */ \
  60. 10 * 1000, \
  61. /* min_purge_interval_ms */ \
  62. 5 * 1000 \
  63. }
  64. #endif /* JEMALLOC_INTERNAL_HPA_OPTS_H */