Changeset 0f4f1b2 in mainline for kernel/test/mm/slab2.c
- Timestamp:
- 2024-01-15T17:10:27Z (11 months ago)
- Branches:
- master
- Children:
- e82879c
- Parents:
- a064d4f
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2024-01-15 16:37:22)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2024-01-15 17:10:27)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/test/mm/slab2.c
ra064d4f r0f4f1b2 127 127 128 128 static slab_cache_t *thr_cache; 129 static semaphore_t thr_sem;130 129 static condvar_t thread_starter; 131 130 static mutex_t starter_mutex; … … 188 187 if (!test_quiet) 189 188 slab_print_list(); 190 191 semaphore_up(&thr_sem);192 189 } 193 190 … … 198 195 * then release everything, then again allocate, then release 199 196 */ 200 thread_t *t;201 int i;202 197 203 198 TPRINTF("Running stress test with size %d\n", size); … … 207 202 208 203 thr_cache = slab_cache_create("thread_cache", size, 0, NULL, NULL, 0); 209 semaphore_initialize(&thr_sem, 0); 210 for (i = 0; i < THREADS; i++) { 211 if (!(t = thread_create(slabtest, NULL, TASK, THREAD_FLAG_NONE, "slabtest"))) { 204 205 thread_t *threads[THREADS] = { }; 206 207 for (int i = 0; i < THREADS; i++) { 208 threads[i] = thread_create(slabtest, NULL, 209 TASK, THREAD_FLAG_NONE, "slabtest"); 210 if (threads[i]) { 211 thread_start(threads[i]); 212 } else { 212 213 TPRINTF("Could not create thread %d\n", i); 213 } else214 thread_ready(t);215 } 214 } 215 } 216 216 217 thread_sleep(1); 217 218 condvar_broadcast(&thread_starter); 218 219 219 for (i = 0; i < THREADS; i++) 220 semaphore_down(&thr_sem); 220 for (int i = 0; i < THREADS; i++) { 221 if (threads[i] != NULL) 222 thread_join(threads[i]); 223 } 221 224 222 225 slab_cache_destroy(thr_cache);
Note:
See TracChangeset
for help on using the changeset viewer.