malloc: Decrease resource usage for malloc tests

Message ID 20230607173955.2696730-1-adhemerval.zanella@linaro.org
State Committed
Commit 94384bdf3955e59f508a6d927065fe0aa824d82b
Headers
Series malloc: Decrease resource usage for malloc tests |

Checks

Context Check Description
redhat-pt-bot/TryBot-apply_patch success Patch applied to master at the time it was sent
redhat-pt-bot/TryBot-32bit success Build for i686
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_glibc_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_glibc_check--master-arm success Testing passed

Commit Message

Adhemerval Zanella Netto June 7, 2023, 5:39 p.m. UTC
  The tst-mallocfork2 and tst-mallocfork3 create large number of
subprocesss, around 11k for former and 20k for latter, to check
for malloc async-signal-safeness on both fork and _Fork.  However
they do not really exercise allocation patterns different than
other tests fro malloc itself, and the spawned process just exit
without any extra computation.

The tst-malloc-tcache-leak is similar, but creates 100k threads
and already checks the resulting with mallinfo.

These tests are also very sensitive to system load (since they
estresss heavy the kernel resource allocation), and adding them
on THP tunable and mcheck tests increase the pressure even more.

For THP the fork tests do not add any more coverage than other
tests.  The mcheck is also not enable for tst-malloc-tcache-leak.

Checked on x86_64-linux-gnu.
---
 malloc/Makefile | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)
  

Comments

Carlos O'Donell June 12, 2023, 1:34 p.m. UTC | #1
On 6/7/23 13:39, Adhemerval Zanella via Libc-alpha wrote:
> The tst-mallocfork2 and tst-mallocfork3 create large number of
> subprocesss, around 11k for former and 20k for latter, to check
> for malloc async-signal-safeness on both fork and _Fork.  However
> they do not really exercise allocation patterns different than
> other tests fro malloc itself, and the spawned process just exit
> without any extra computation.

Agreed.

> The tst-malloc-tcache-leak is similar, but creates 100k threads
> and already checks the resulting with mallinfo.
> 
> These tests are also very sensitive to system load (since they
> estresss heavy the kernel resource allocation), and adding them
> on THP tunable and mcheck tests increase the pressure even more.
> 
> For THP the fork tests do not add any more coverage than other
> tests.  The mcheck is also not enable for tst-malloc-tcache-leak.
> 
> Checked on x86_64-linux-gnu.

LGTM.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>

> ---
>  malloc/Makefile | 23 +++++++++++------------
>  1 file changed, 11 insertions(+), 12 deletions(-)
> 
> diff --git a/malloc/Makefile b/malloc/Makefile
> index ce6ebcf1b3..c1db3347d8 100644
> --- a/malloc/Makefile
> +++ b/malloc/Makefile
> @@ -74,7 +74,10 @@ test-srcs = tst-mtrace
>  # with MALLOC_CHECK_=3 because they expect a specific failure.
>  tests-exclude-malloc-check = tst-malloc-check tst-malloc-usable \
>  	tst-mxfast tst-safe-linking \
> -	tst-compathooks-off tst-compathooks-on tst-memalign-2 tst-memalign-3
> +	tst-compathooks-off tst-compathooks-on tst-memalign-2 tst-memalign-3 \
> +	tst-mallocfork2 \
> +	tst-mallocfork3 \
> +	tst-malloc-tcache-leak
>  
>  # Run all tests with MALLOC_CHECK_=3
>  tests-malloc-check = $(filter-out $(tests-exclude-malloc-check) \
> @@ -92,7 +95,10 @@ tests-exclude-hugetlb1 = \
>  	tst-interpose-static-thread \
>  	tst-malloc-usable \
>  	tst-malloc-usable-tunables \
> -	tst-mallocstate
> +	tst-mallocstate \
> +	tst-malloc-tcache-leak \
> +	tst-mallocfork2 \
> +	tst-mallocfork3
>  # The tst-free-errno relies on the used malloc page size to mmap an
>  # overlapping region.
>  tests-exclude-hugetlb2 = \
> @@ -121,7 +127,9 @@ tests-exclude-mcheck = tst-mallocstate \
>  	tst-compathooks-off tst-compathooks-on \
>  	tst-memalign-2 \
>  	tst-memalign-3 \
> -	tst-mxfast
> +	tst-mxfast \
> +	tst-mallocfork2 \
> +	tst-mallocfork3
>  
>  tests-mcheck = $(filter-out $(tests-exclude-mcheck) $(tests-static), $(tests))
>  endif
> @@ -182,14 +190,10 @@ $(objpfx)tst-malloc-fork-deadlock-malloc-check: $(shared-thread-library)
>  $(objpfx)tst-malloc-stats-cancellation-malloc-check: $(shared-thread-library)
>  $(objpfx)tst-malloc-thread-exit-malloc-hugetlb1: $(shared-thread-library)
>  $(objpfx)tst-malloc-thread-fail-malloc-hugetlb1: $(shared-thread-library)
> -$(objpfx)tst-mallocfork2-malloc-hugetlb1: $(shared-thread-library)
> -$(objpfx)tst-mallocfork3-malloc-hugetlb1: $(shared-thread-library)
>  $(objpfx)tst-malloc-fork-deadlock-malloc-hugetlb1: $(shared-thread-library)
>  $(objpfx)tst-malloc-stats-cancellation-malloc-hugetlb1: $(shared-thread-library)
>  $(objpfx)tst-malloc-thread-exit-malloc-hugetlb2: $(shared-thread-library)
>  $(objpfx)tst-malloc-thread-fail-malloc-hugetlb2: $(shared-thread-library)
> -$(objpfx)tst-mallocfork2-malloc-hugetlb2: $(shared-thread-library)
> -$(objpfx)tst-mallocfork3-malloc-hugetlb2: $(shared-thread-library)
>  $(objpfx)tst-malloc-fork-deadlock-malloc-hugetlb2: $(shared-thread-library)
>  $(objpfx)tst-malloc-stats-cancellation-malloc-hugetlb2: $(shared-thread-library)
>  
> @@ -344,14 +348,9 @@ $(objpfx)tst-dynarray-fail-mem.out: $(objpfx)tst-dynarray-fail.out
>  $(objpfx)tst-malloc-tcache-leak: $(shared-thread-library)
>  $(objpfx)tst-malloc_info: $(shared-thread-library)
>  $(objpfx)tst-mallocfork2: $(shared-thread-library)
> -$(objpfx)tst-malloc-tcache-leak-mcheck: $(shared-thread-library)
>  $(objpfx)tst-malloc_info-mcheck: $(shared-thread-library)
> -$(objpfx)tst-mallocfork2-mcheck: $(shared-thread-library)
> -$(objpfx)tst-malloc-tcache-leak-malloc-check: $(shared-thread-library)
>  $(objpfx)tst-malloc_info-malloc-check: $(shared-thread-library)
>  $(objpfx)tst-mallocfork2-malloc-check: $(shared-thread-library)
> -$(objpfx)tst-malloc-tcache-leak-malloc-hugetlb1: $(shared-thread-library)
> -$(objpfx)tst-malloc-tcache-leak-malloc-hugetlb2: $(shared-thread-library)
>  $(objpfx)tst-malloc_info-malloc-hugetlb1: $(shared-thread-library)
>  $(objpfx)tst-malloc_info-malloc-hugetlb2: $(shared-thread-library)
>  $(objpfx)tst-memalign-3: $(shared-thread-library)
  

Patch

diff --git a/malloc/Makefile b/malloc/Makefile
index ce6ebcf1b3..c1db3347d8 100644
--- a/malloc/Makefile
+++ b/malloc/Makefile
@@ -74,7 +74,10 @@  test-srcs = tst-mtrace
 # with MALLOC_CHECK_=3 because they expect a specific failure.
 tests-exclude-malloc-check = tst-malloc-check tst-malloc-usable \
 	tst-mxfast tst-safe-linking \
-	tst-compathooks-off tst-compathooks-on tst-memalign-2 tst-memalign-3
+	tst-compathooks-off tst-compathooks-on tst-memalign-2 tst-memalign-3 \
+	tst-mallocfork2 \
+	tst-mallocfork3 \
+	tst-malloc-tcache-leak
 
 # Run all tests with MALLOC_CHECK_=3
 tests-malloc-check = $(filter-out $(tests-exclude-malloc-check) \
@@ -92,7 +95,10 @@  tests-exclude-hugetlb1 = \
 	tst-interpose-static-thread \
 	tst-malloc-usable \
 	tst-malloc-usable-tunables \
-	tst-mallocstate
+	tst-mallocstate \
+	tst-malloc-tcache-leak \
+	tst-mallocfork2 \
+	tst-mallocfork3
 # The tst-free-errno relies on the used malloc page size to mmap an
 # overlapping region.
 tests-exclude-hugetlb2 = \
@@ -121,7 +127,9 @@  tests-exclude-mcheck = tst-mallocstate \
 	tst-compathooks-off tst-compathooks-on \
 	tst-memalign-2 \
 	tst-memalign-3 \
-	tst-mxfast
+	tst-mxfast \
+	tst-mallocfork2 \
+	tst-mallocfork3
 
 tests-mcheck = $(filter-out $(tests-exclude-mcheck) $(tests-static), $(tests))
 endif
@@ -182,14 +190,10 @@  $(objpfx)tst-malloc-fork-deadlock-malloc-check: $(shared-thread-library)
 $(objpfx)tst-malloc-stats-cancellation-malloc-check: $(shared-thread-library)
 $(objpfx)tst-malloc-thread-exit-malloc-hugetlb1: $(shared-thread-library)
 $(objpfx)tst-malloc-thread-fail-malloc-hugetlb1: $(shared-thread-library)
-$(objpfx)tst-mallocfork2-malloc-hugetlb1: $(shared-thread-library)
-$(objpfx)tst-mallocfork3-malloc-hugetlb1: $(shared-thread-library)
 $(objpfx)tst-malloc-fork-deadlock-malloc-hugetlb1: $(shared-thread-library)
 $(objpfx)tst-malloc-stats-cancellation-malloc-hugetlb1: $(shared-thread-library)
 $(objpfx)tst-malloc-thread-exit-malloc-hugetlb2: $(shared-thread-library)
 $(objpfx)tst-malloc-thread-fail-malloc-hugetlb2: $(shared-thread-library)
-$(objpfx)tst-mallocfork2-malloc-hugetlb2: $(shared-thread-library)
-$(objpfx)tst-mallocfork3-malloc-hugetlb2: $(shared-thread-library)
 $(objpfx)tst-malloc-fork-deadlock-malloc-hugetlb2: $(shared-thread-library)
 $(objpfx)tst-malloc-stats-cancellation-malloc-hugetlb2: $(shared-thread-library)
 
@@ -344,14 +348,9 @@  $(objpfx)tst-dynarray-fail-mem.out: $(objpfx)tst-dynarray-fail.out
 $(objpfx)tst-malloc-tcache-leak: $(shared-thread-library)
 $(objpfx)tst-malloc_info: $(shared-thread-library)
 $(objpfx)tst-mallocfork2: $(shared-thread-library)
-$(objpfx)tst-malloc-tcache-leak-mcheck: $(shared-thread-library)
 $(objpfx)tst-malloc_info-mcheck: $(shared-thread-library)
-$(objpfx)tst-mallocfork2-mcheck: $(shared-thread-library)
-$(objpfx)tst-malloc-tcache-leak-malloc-check: $(shared-thread-library)
 $(objpfx)tst-malloc_info-malloc-check: $(shared-thread-library)
 $(objpfx)tst-mallocfork2-malloc-check: $(shared-thread-library)
-$(objpfx)tst-malloc-tcache-leak-malloc-hugetlb1: $(shared-thread-library)
-$(objpfx)tst-malloc-tcache-leak-malloc-hugetlb2: $(shared-thread-library)
 $(objpfx)tst-malloc_info-malloc-hugetlb1: $(shared-thread-library)
 $(objpfx)tst-malloc_info-malloc-hugetlb2: $(shared-thread-library)
 $(objpfx)tst-memalign-3: $(shared-thread-library)