Loading...
tests/threaded_stress.c libmalloc-792.1.1 libmalloc-646.0.13
--- libmalloc/libmalloc-792.1.1/tests/threaded_stress.c
+++ libmalloc/libmalloc-646.0.13/tests/threaded_stress.c
@@ -12,9 +12,6 @@
 #if !MALLOC_TARGET_EXCLAVES
 #include <sys/sysctl.h>
 #include <mach/mach.h>
-typedef unsigned seed_type_t;
-#else
-typedef unsigned long seed_type_t;
 #endif // !MALLOC_TARGET_EXCLAVES
 
 // These tests are based on perf_contended_malloc_free, but intended as
@@ -30,7 +27,7 @@
 #pragma mark -
 
 static uint64_t
-random_busy_counts(seed_type_t *seed, uint64_t *first, uint64_t *second)
+random_busy_counts(unsigned int *seed, uint64_t *first, uint64_t *second)
 {
 	uint64_t random = rand_r(seed);
 	*first = 0x4 + (random & (0x10 - 1));
@@ -230,7 +227,7 @@
 {
 	kern_return_t kr;
 	int r;
-	seed_type_t seed;
+	unsigned int seed;
 	volatile double dummy;
 	uint64_t pos, remaining_frees;
 	void *alloc;
@@ -263,15 +260,11 @@
 			if (!remaining_frees--) break;
 			alloc = NULL;
 		}
-
-		// Size without taking ownership to allow another thread to race to free
-		(void)malloc_size(allocations[pos % live_allocations]);
-
 		alloc = atomic_exchange(
 				(_Atomic(void *) *)&allocations[(pos++)%live_allocations],
 				alloc);
 		if (alloc) {
-			// Size again while definitely allocated
+			// Size once while allocated
 			(void)malloc_size(alloc);
 
 			dummy = busy(second);
@@ -279,7 +272,7 @@
 
 			// Calling malloc_size on free pointers isn't safe in exclaves
 #if !MALLOC_TARGET_EXCLAVES
-			// Size again while probably free, but possibly re-allocated
+			// Try again while (possibly) free
 			malloc_size(alloc);
 #endif // !MALLOC_TARGET_EXCLAVES
 		}
@@ -290,21 +283,7 @@
 }
 
 T_DECL(threaded_stress_malloc_size_tiny,
-		"multi-threaded stress test for tiny malloc_size",
-		T_META_ENVVAR("MallocNanoZone=0"))
-{
-	uint64_t iterations = 2000000ull;
-#if TARGET_OS_TV || TARGET_OS_WATCH
-	iterations = 200000ull;
-#endif // TARGET_OS_TV || TARGET_OS_WATCH
-
-	malloc_threaded_stress(false, 16, 256, 16, 2048,
-			iterations, malloc_size_stress_thread);
-}
-
-T_DECL(threaded_stress_malloc_size_nano,
-		"multi-threaded stress test for nano malloc_size",
-		T_META_ENVVAR("MallocNanoZone=1"))
+		"multi-threaded stress test for tiny malloc_size")
 {
 	uint64_t iterations = 2000000ull;
 #if TARGET_OS_TV || TARGET_OS_WATCH