1
1
// SPDX-License-Identifier: BSD-3-Clause
2
- /* Copyright 2015-2020 , Intel Corporation */
2
+ /* Copyright 2015-2023 , Intel Corporation */
3
3
4
4
/*
5
5
* obj_pmalloc_mt.c -- multithreaded test of allocator
@@ -59,9 +59,12 @@ static void *
59
59
realloc_worker (void * arg )
60
60
{
61
61
struct worker_args * a = arg ;
62
+ int ret ;
62
63
63
64
for (unsigned i = 0 ; i < Ops_per_thread ; ++ i ) {
64
- prealloc (a -> pop , & a -> r -> offs [a -> idx ][i ], REALLOC_SIZE , 0 , 0 );
65
+ ret = prealloc (a -> pop , & a -> r -> offs [a -> idx ][i ],
66
+ REALLOC_SIZE , 0 , 0 );
67
+ UT_ASSERTeq (ret , 0 );
65
68
UT_ASSERTne (a -> r -> offs [a -> idx ][i ], 0 );
66
69
}
67
70
@@ -85,15 +88,17 @@ static void *
85
88
mix_worker (void * arg )
86
89
{
87
90
struct worker_args * a = arg ;
91
+ int ret ;
88
92
89
93
/*
90
94
* The mix scenario is ran twice to increase the chances of run
91
95
* contention.
92
96
*/
93
97
for (unsigned j = 0 ; j < MIX_RERUNS ; ++ j ) {
94
98
for (unsigned i = 0 ; i < Ops_per_thread ; ++ i ) {
95
- pmalloc (a -> pop , & a -> r -> offs [a -> idx ][i ],
99
+ ret = pmalloc (a -> pop , & a -> r -> offs [a -> idx ][i ],
96
100
ALLOC_SIZE , 0 , 0 );
101
+ UT_ASSERTeq (ret , 0 );
97
102
UT_ASSERTne (a -> r -> offs [a -> idx ][i ], 0 );
98
103
}
99
104
@@ -338,7 +343,8 @@ main(int argc, char *argv[])
338
343
339
344
if (!exists ) {
340
345
pop = pmemobj_create (argv [4 ], "TEST" , (PMEMOBJ_MIN_POOL ) +
341
- (MAX_THREADS * CHUNKSIZE * CHUNKS_PER_THREAD ),
346
+ (MAX_THREADS * CHUNKSIZE * CHUNKS_PER_THREAD ) +
347
+ (MAX_THREADS * MAX_OPS_PER_THREAD * REALLOC_SIZE ),
342
348
0666 );
343
349
344
350
if (pop == NULL )
0 commit comments