Skip to content

Commit 5ca1c93

Browse files
author
Pat
authored
cmake: add support for jemalloc page size config (#5020)
* cmake: add support for jemalloc page size config Signed-off-by: Patrick Stephens <[email protected]> * cmake: make all options configurable Signed-off-by: Patrick Stephens <[email protected]>
1 parent 3e99571 commit 5ca1c93

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -713,10 +713,14 @@ if(FLB_JEMALLOC AND ${CMAKE_SYSTEM_NAME} MATCHES "Linux")
713713
FLB_DEFINITION(FLB_HAVE_JEMALLOC)
714714
FLB_DEFINITION(JEMALLOC_MANGLE)
715715

716+
# Add support for options like page size
717+
set(FLB_JEMALLOC_OPTIONS "--with-lg-quantum=3" CACHE string "Extra options to configure jemalloc")
718+
message(STATUS "jemalloc configuration: \"${FLB_JEMALLOC_OPTIONS}\"")
719+
716720
# Link to Jemalloc as an external dependency
717721
ExternalProject_Add(jemalloc
718722
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/jemalloc-5.2.1
719-
CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/lib/jemalloc-5.2.1/configure ${AUTOCONF_HOST_OPT} --with-lg-quantum=3 --prefix=<INSTALL_DIR>
723+
CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/lib/jemalloc-5.2.1/configure ${AUTOCONF_HOST_OPT} ${FLB_JEMALLOC_OPTIONS} --prefix=<INSTALL_DIR>
720724
CFLAGS=-std=gnu99\ -Wall\ -pipe\ -g3\ -O3\ -funroll-loops
721725
BUILD_COMMAND $(MAKE)
722726
INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/

packaging/distros/centos/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ RUN yum -y update && \
4646
ARG FLB_OUT_PGSQL=Off
4747
ENV FLB_OUT_PGSQL=$FLB_OUT_PGSQL
4848

49+
# Need larger page size
50+
ARG FLB_JEMALLOC_OPTIONS="--with-lg-page=16 --with-lg-quantum=3"
51+
ENV FLB_JEMALLOC_OPTIONS=$FLB_JEMALLOC_OPTIONS
52+
4953
# centos/8 base image
5054
FROM centos:8 as centos-8-base
5155

@@ -90,6 +94,10 @@ RUN yum -y update && \
9094
ARG FLB_OUT_PGSQL=On
9195
ENV FLB_OUT_PGSQL=$FLB_OUT_PGSQL
9296

97+
# Need larger page size
98+
ARG FLB_JEMALLOC_OPTIONS="--with-lg-page=16 --with-lg-quantum=3"
99+
ENV FLB_JEMALLOC_OPTIONS=$FLB_JEMALLOC_OPTIONS
100+
93101
# Common build for all distributions now
94102
# hadolint ignore=DL3006
95103
FROM $BASE_BUILDER as builder
@@ -134,6 +142,7 @@ RUN cmake3 -DCMAKE_INSTALL_PREFIX="$CMAKE_INSTALL_PREFIX" \
134142
-DFLB_OUT_KAFKA="$FLB_OUT_KAFKA" \
135143
-DFLB_OUT_PGSQL="$FLB_OUT_PGSQL" \
136144
-DFLB_NIGHTLY_BUILD="$FLB_NIGHTLY_BUILD" \
145+
-DFLB_JEMALLOC_OPTIONS="$FLB_JEMALLOC_OPTIONS" \
137146
../
138147

139148
VOLUME [ "/output" ]

0 commit comments

Comments
 (0)