aboutsummaryrefslogtreecommitdiff
path: root/malloc
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@sourceware.org>2016-12-31 23:33:27 +0530
committerSiddhesh Poyarekar <siddhesh@sourceware.org>2016-12-31 23:49:24 +0530
commit9dd409a5f4a7a053cc962f8371dad0fe5cc22597 (patch)
treea205733e557ccf0b66021deff34cd6b690150f9e /malloc
parent67e58f39412ecd4467034761f3f074283c90f3c8 (diff)
downloadglibc-9dd409a5f4a7a053cc962f8371dad0fe5cc22597.zip
glibc-9dd409a5f4a7a053cc962f8371dad0fe5cc22597.tar.gz
glibc-9dd409a5f4a7a053cc962f8371dad0fe5cc22597.tar.bz2
Initialize tunable list with the GLIBC_TUNABLES environment variable
Read tunables values from the users using the GLIBC_TUNABLES environment variable. The value of this variable is a colon-separated list of name=value pairs. So a typical string would look like this: GLIBC_TUNABLES=glibc.malloc.mmap_threshold=2048:glibc.malloc.trim_threshold=1024 * config.make.in (have-loop-to-function): Define. * elf/Makefile (CFLAGS-dl-tunables.c): Add -fno-tree-loop-distribute-patterns. * elf/dl-tunables.c: Include libc-internals.h. (GLIBC_TUNABLES): New macro. (tunables_strdup): New function. (parse_tunables): New function. (min_strlen): New function. (__tunables_init): Use the new functions and macro. (disable_tunable): Disable tunable from GLIBC_TUNABLES. * malloc/tst-malloc-usable-tunables.c: New test case. * malloc/tst-malloc-usable-static-tunables.c: New test case. * malloc/Makefile (tests, tests-static): Add tests.
Diffstat (limited to 'malloc')
-rw-r--r--malloc/Makefile6
-rw-r--r--malloc/tst-malloc-usable-static-tunables.c1
-rw-r--r--malloc/tst-malloc-usable-tunables.c1
3 files changed, 7 insertions, 1 deletions
diff --git a/malloc/Makefile b/malloc/Makefile
index 4e4104e..a34e20c 100644
--- a/malloc/Makefile
+++ b/malloc/Makefile
@@ -33,11 +33,13 @@ tests := mallocbug tst-malloc tst-valloc tst-calloc tst-obstack \
tst-mallocfork2 \
tst-interpose-nothread \
tst-interpose-thread \
+ tst-malloc-usable-tunables
tests-static := \
tst-interpose-static-nothread \
tst-interpose-static-thread \
- tst-malloc-usable-static
+ tst-malloc-usable-static \
+ tst-malloc-usable-static-tunables
tests += $(tests-static)
test-srcs = tst-mtrace
@@ -160,6 +162,8 @@ endif
tst-mcheck-ENV = MALLOC_CHECK_=3
tst-malloc-usable-ENV = MALLOC_CHECK_=3
tst-malloc-usable-static-ENV = $(tst-malloc-usable-ENV)
+tst-malloc-usable-tunables-ENV = GLIBC_TUNABLES=glibc.malloc.check=3
+tst-malloc-usable-static-tunables-ENV = $(tst-malloc-usable-tunables-ENV)
# Uncomment this for test releases. For public releases it is too expensive.
#CPPFLAGS-malloc.o += -DMALLOC_DEBUG=1
diff --git a/malloc/tst-malloc-usable-static-tunables.c b/malloc/tst-malloc-usable-static-tunables.c
new file mode 100644
index 0000000..8907db0
--- /dev/null
+++ b/malloc/tst-malloc-usable-static-tunables.c
@@ -0,0 +1 @@
+#include <malloc/tst-malloc-usable.c>
diff --git a/malloc/tst-malloc-usable-tunables.c b/malloc/tst-malloc-usable-tunables.c
new file mode 100644
index 0000000..8907db0
--- /dev/null
+++ b/malloc/tst-malloc-usable-tunables.c
@@ -0,0 +1 @@
+#include <malloc/tst-malloc-usable.c>