diff --git a/INSTALL.md b/INSTALL.md index eb55acfd..2aaa33e1 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -250,6 +250,13 @@ any of the following arguments (not a definitive list) to 'configure': configuration, jemalloc will provide additional size classes that are not 16-byte-aligned (24, 40, and 56). +* `--with-lg-slab-maxregs=` + + Specify the maximum number of regions in a slab, which is + ( - ) by default. This increases the limit of slab + sizes specified by "slab_sizes" in malloc_conf. This should never be less + than the default value. + * `--with-lg-vaddr=` Specify the number of significant virtual address bits. By default, the diff --git a/configure.ac b/configure.ac index d68d376c..7c203020 100644 --- a/configure.ac +++ b/configure.ac @@ -1586,6 +1586,15 @@ if test "x$with_lg_quantum" != "x" ; then AC_DEFINE_UNQUOTED([LG_QUANTUM], [$with_lg_quantum]) fi +AC_ARG_WITH([lg_slab_maxregs], + [AS_HELP_STRING([--with-lg-slab-maxregs=], + [Base 2 log of maximum number of regions in a slab (used with malloc_conf slab_sizes)])], + [LG_SLAB_MAXREGS="with_lg_slab_maxregs"], + [LG_SLAB_MAXREGS=""]) +if test "x$with_lg_slab_maxregs" != "x" ; then + AC_DEFINE_UNQUOTED([LG_SLAB_MAXREGS], [$with_lg_slab_maxregs]) +fi + AC_ARG_WITH([lg_page], [AS_HELP_STRING([--with-lg-page=], [Base 2 log of system page size])], [LG_PAGE="$with_lg_page"], [LG_PAGE="detect"]) diff --git a/include/jemalloc/internal/jemalloc_internal_defs.h.in b/include/jemalloc/internal/jemalloc_internal_defs.h.in index ee052bb8..7a4ebf17 100644 --- a/include/jemalloc/internal/jemalloc_internal_defs.h.in +++ b/include/jemalloc/internal/jemalloc_internal_defs.h.in @@ -182,6 +182,9 @@ /* One page is 2^LG_PAGE bytes. */ #undef LG_PAGE +/* Maximum number of regions in a slab. */ +#undef LG_SLAB_MAXREGS + /* * One huge page is 2^LG_HUGEPAGE bytes. Note that this is defined even if the * system does not explicitly support huge pages; system calls that require diff --git a/include/jemalloc/internal/sc.h b/include/jemalloc/internal/sc.h index 138da5c0..133763da 100644 --- a/include/jemalloc/internal/sc.h +++ b/include/jemalloc/internal/sc.h @@ -270,8 +270,14 @@ #define SC_LARGE_MAXCLASS (SC_MAX_BASE + (SC_NGROUP - 1) * SC_MAX_DELTA) /* Maximum number of regions in one slab. */ -#define SC_LG_SLAB_MAXREGS (LG_PAGE - SC_LG_TINY_MIN) -#define SC_SLAB_MAXREGS (1U << LG_SLAB_MAXREGS) +#ifndef LG_SLAB_MAXREGS +# define SC_LG_SLAB_MAXREGS (LG_PAGE - SC_LG_TINY_MIN) +#elif (LG_SLAB_MAXREGS < (LG_PAGE - SC_LG_TINY_MIN)) +# error "Unsupported SC_LG_SLAB_MAXREGS" +#else +# define SC_LG_SLAB_MAXREGS LG_SLAB_MAXREGS +#endif +#define SC_SLAB_MAXREGS (1U << SC_LG_SLAB_MAXREGS) typedef struct sc_s sc_t;