diff mbox series

[v2,4/10] validation: sched: honour max queue size

Message ID 1519293622-14665-5-git-send-email-odpbot@yandex.ru
State Superseded
Headers show
Series [v2,1/10] linux-gen: queue: inline queue from index conversion | expand

Commit Message

Github ODP bot Feb. 22, 2018, 10 a.m. UTC
From: Petri Savolainen <petri.savolainen@linaro.org>


When needed, scale down atomic queue size requirement
to maximum queue size capability.

Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>

---
/** Email created from pull request 492 (psavol:master-sched-optim)
 ** https://github.com/Linaro/odp/pull/492
 ** Patch: https://github.com/Linaro/odp/pull/492.patch
 ** Base sha: 5a58bbf2bb331fd7dde2ebbc0430634ace6900fb
 ** Merge commit sha: b29563293c1bca56419d2dc355a8e64d961e024a
 **/
 test/validation/api/scheduler/scheduler.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/test/validation/api/scheduler/scheduler.c b/test/validation/api/scheduler/scheduler.c
index 9d1e08ca1..d95766734 100644
--- a/test/validation/api/scheduler/scheduler.c
+++ b/test/validation/api/scheduler/scheduler.c
@@ -57,6 +57,7 @@  typedef struct {
 	odp_barrier_t barrier;
 	int buf_count;
 	int buf_count_cpy;
+	uint32_t max_sched_queue_size;
 	odp_ticketlock_t lock;
 	odp_spinlock_t atomic_lock;
 	struct {
@@ -1060,7 +1061,7 @@  static void parallel_execute(odp_schedule_sync_t sync, int num_queues,
 	args->num_queues = num_queues;
 	args->num_prio = num_prio;
 	if (enable_excl_atomic)
-		args->num_bufs = BUFS_PER_QUEUE_EXCL;
+		args->num_bufs = globals->max_sched_queue_size;
 	else
 		args->num_bufs = BUFS_PER_QUEUE;
 	args->num_workers = globals->num_workers;
@@ -1405,7 +1406,7 @@  static void scheduler_test_ordered_lock(void)
 	CU_ASSERT(ret == 0);
 }
 
-static int create_queues(void)
+static int create_queues(test_globals_t *globals)
 {
 	int i, j, prios, rc;
 	odp_queue_capability_t capa;
@@ -1427,6 +1428,12 @@  static int create_queues(void)
 		       capa.max_ordered_locks);
 	}
 
+	globals->max_sched_queue_size = BUFS_PER_QUEUE_EXCL;
+	if (capa.sched.max_size && capa.sched.max_size < BUFS_PER_QUEUE_EXCL) {
+		printf("Max sched queue size %u\n", capa.sched.max_size);
+		globals->max_sched_queue_size = capa.sched.max_size;
+	}
+
 	prios = odp_schedule_num_prio();
 	odp_pool_param_init(&params);
 	params.buf.size = sizeof(queue_context);
@@ -1455,17 +1462,17 @@  static int create_queues(void)
 			q = odp_queue_create(name, &p);
 
 			if (q == ODP_QUEUE_INVALID) {
-				printf("Schedule queue create failed.\n");
+				printf("Parallel queue create failed.\n");
 				return -1;
 			}
 
 			snprintf(name, sizeof(name), "sched_%d_%d_a", i, j);
 			p.sched.sync = ODP_SCHED_SYNC_ATOMIC;
-			p.size = BUFS_PER_QUEUE_EXCL;
+			p.size = globals->max_sched_queue_size;
 			q = odp_queue_create(name, &p);
 
 			if (q == ODP_QUEUE_INVALID) {
-				printf("Schedule queue create failed.\n");
+				printf("Atomic queue create failed.\n");
 				return -1;
 			}
 
@@ -1501,7 +1508,7 @@  static int create_queues(void)
 			q = odp_queue_create(name, &p);
 
 			if (q == ODP_QUEUE_INVALID) {
-				printf("Schedule queue create failed.\n");
+				printf("Ordered queue create failed.\n");
 				return -1;
 			}
 			if (odp_queue_lock_count(q) !=
@@ -1598,7 +1605,7 @@  static int scheduler_suite_init(void)
 	odp_ticketlock_init(&globals->lock);
 	odp_spinlock_init(&globals->atomic_lock);
 
-	if (create_queues() != 0)
+	if (create_queues(globals) != 0)
 		return -1;
 
 	return 0;