From 2076e8aba553a0f8bb499803f8bd206113e79033 Mon Sep 17 00:00:00 2001 From: mmacy Date: Fri, 11 May 2018 04:47:05 +0000 Subject: [PATCH] Test priority handling in epoch test. - Double the number of test threads to mp_ncpu*2 - Give each thread a different scheduling priority --- sys/tests/epoch/epoch_test.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/sys/tests/epoch/epoch_test.c b/sys/tests/epoch/epoch_test.c index 8085183dc7a..901024ea7b6 100644 --- a/sys/tests/epoch/epoch_test.c +++ b/sys/tests/epoch/epoch_test.c @@ -38,6 +38,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include #include @@ -132,16 +134,24 @@ static struct epoch_test_instance etilist[MAXCPU]; static int test_modinit(void) { - int i, error; + struct thread *td; + int i, error, pri_range, pri_off; + pri_range = PRI_MIN_TIMESHARE - PRI_MIN_REALTIME; test_epoch = epoch_alloc(); - for (i = 0; i < mp_ncpus; i++) { + for (i = 0; i < mp_ncpus*2; i++) { etilist[i].threadid = i; error = kthread_add(testloop, &etilist[i], NULL, &testthreads[i], 0, 0, "epoch_test_%d", i); if (error) { printf("%s: kthread_add(epoch_test): error %d", __func__, error); + } else { + pri_off = (i*4)%pri_range; + td = testthreads[i]; + thread_lock(td); + sched_prio(td, PRI_MIN_REALTIME + pri_off); + thread_unlock(td); } } inited = 1; -- 2.45.0