summary refs log tree commit diff
path: root/malloc/Makefile
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-08-20 13:22:35 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-12-15 17:35:39 -0300
commitc1beb51d08d3d7ec935b0a2419b4c6fad91d1969 (patch)
tree6c5b2faf0fa3044c61e4462ff4ba540d976cbb44 /malloc/Makefile
parent98d5fcb8d099a1a868e032c89891c395a2f365c5 (diff)
downloadglibc-c1beb51d08d3d7ec935b0a2419b4c6fad91d1969.tar.gz
glibc-c1beb51d08d3d7ec935b0a2419b4c6fad91d1969.tar.xz
glibc-c1beb51d08d3d7ec935b0a2419b4c6fad91d1969.zip
malloc: Add Huge Page support to arenas
It is enabled as default for glibc.malloc.hugetlb set to 2 or higher.
It also uses a non configurable minimum value and maximum value,
currently set respectively to 1 and 4 selected huge page size.

The arena allocation with huge pages does not use MAP_NORESERVE.  As
indicate by kernel internal documentation [1], the flag might trigger
a SIGBUS on soft page faults if at memory access there is no left
pages in the pool.

On systems without a reserved huge pages pool, is just stress the
mmap(MAP_HUGETLB) allocation failure.  To improve test coverage it is
required to create a pool with some allocated pages.

Checked on x86_64-linux-gnu with no reserved pages, 10 reserved pages
(which trigger mmap(MAP_HUGETBL) failures) and with 256 reserved pages
(which does not trigger mmap(MAP_HUGETLB) failures).

[1] https://www.kernel.org/doc/html/v4.18/vm/hugetlbfs_reserv.html#resv-map-modifications

Reviewed-by: DJ Delorie <dj@redhat.com>
Diffstat (limited to 'malloc/Makefile')
-rw-r--r--malloc/Makefile7
1 files changed, 6 insertions, 1 deletions
diff --git a/malloc/Makefile b/malloc/Makefile
index e9a6666d22..451eb84612 100644
--- a/malloc/Makefile
+++ b/malloc/Makefile
@@ -91,10 +91,15 @@ tests-exclude-hugetlb1 = \
 	tst-malloc-usable \
 	tst-malloc-usable-tunables \
 	tst-mallocstate
+# The tst-free-errno relies on the used malloc page size to mmap an
+# overlapping region.
+tests-exclude-hugetlb2 = \
+	$(tests-exclude-hugetlb1) \
+	tst-free-errno
 tests-malloc-hugetlb1 = \
 	$(filter-out $(tests-exclude-hugetlb1), $(tests))
 tests-malloc-hugetlb2 = \
-	$(filter-out $(tests-exclude-hugetlb1), $(tests))
+	$(filter-out $(tests-exclude-hugetlb2), $(tests))
 
 # -lmcheck needs __malloc_initialize_hook, which was deprecated in 2.24.
 ifeq ($(have-GLIBC_2.23)$(build-shared),yesyes)