diff options
author | Matias Elo <matias.elo@nokia.com> | 2022-12-15 16:00:13 +0200 |
---|---|---|
committer | Petri Savolainen <petri.savolainen@nokia.com> | 2022-12-22 12:25:54 +0200 |
commit | 7f42e20b0715ff3719ccfc2ecf9d09db51a03ca3 (patch) | |
tree | 9ee0930881a9f8079978a6bd0a1aca88b8710408 | |
parent | 1898b096ac0251584f89ddb547b13ebdd4927f61 (diff) |
linux-gen: sched: add config option for adjusting ordered queue stash size
Add new configuration option 'sched_basic.order_stash_size', which can be
used to adjust the size of implementation internal per thread ordered queue
reorder stash. If 'order_stash_size' > 0, events may be dropped by the
implementation if the target queue is full. To prevent this set
'order_stash_size' to 0.
Signed-off-by: Matias Elo <matias.elo@nokia.com>
Reported-and-tested-by: Carl Wallen <carl.wallen@nokia.com>
Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com>
-rw-r--r-- | config/odp-linux-generic.conf | 11 | ||||
-rw-r--r-- | platform/linux-generic/m4/odp_libconfig.m4 | 2 | ||||
-rw-r--r-- | platform/linux-generic/odp_schedule_basic.c | 22 | ||||
-rw-r--r-- | platform/linux-generic/test/inline-timer.conf | 2 | ||||
-rw-r--r-- | platform/linux-generic/test/packet_align.conf | 2 | ||||
-rw-r--r-- | platform/linux-generic/test/process-mode.conf | 2 | ||||
-rw-r--r-- | platform/linux-generic/test/sched-basic.conf | 3 |
7 files changed, 34 insertions, 10 deletions
diff --git a/config/odp-linux-generic.conf b/config/odp-linux-generic.conf index f8accd07f..814035d61 100644 --- a/config/odp-linux-generic.conf +++ b/config/odp-linux-generic.conf @@ -16,7 +16,7 @@ # Mandatory fields odp_implementation = "linux-generic" -config_file_version = "0.1.22" +config_file_version = "0.1.23" # System options system: { @@ -234,6 +234,15 @@ sched_basic: { worker = 1 control = 1 } + + # Ordered queue reorder stash size + # + # Number of events each thread can stash internally before having to + # wait for the right order context. Reorder stash can improve + # performance if threads process events in bursts. If 'order_stash_size' + # > 0, events may be dropped by the implementation if the target queue + # is full. To prevent this set 'order_stash_size' to 0. + order_stash_size = 512 } timer: { diff --git a/platform/linux-generic/m4/odp_libconfig.m4 b/platform/linux-generic/m4/odp_libconfig.m4 index 03dbc929d..658138c31 100644 --- a/platform/linux-generic/m4/odp_libconfig.m4 +++ b/platform/linux-generic/m4/odp_libconfig.m4 @@ -3,7 +3,7 @@ ########################################################################## m4_define([_odp_config_version_generation], [0]) m4_define([_odp_config_version_major], [1]) -m4_define([_odp_config_version_minor], [22]) +m4_define([_odp_config_version_minor], [23]) m4_define([_odp_config_version], [_odp_config_version_generation._odp_config_version_major._odp_config_version_minor]) diff --git a/platform/linux-generic/odp_schedule_basic.c b/platform/linux-generic/odp_schedule_basic.c index 594360326..3fc9c1c17 100644 --- a/platform/linux-generic/odp_schedule_basic.c +++ b/platform/linux-generic/odp_schedule_basic.c @@ -238,13 +238,13 @@ typedef struct { struct { uint8_t burst_default[NUM_SCHED_SYNC][NUM_PRIO]; uint8_t burst_max[NUM_SCHED_SYNC][NUM_PRIO]; + uint16_t order_stash_size; uint8_t num_spread; uint8_t prefer_ratio; } config; - - uint8_t load_balance; - uint16_t max_spread; uint32_t ring_mask; + uint16_t max_spread; + uint8_t load_balance; odp_atomic_u32_t grp_epoch; odp_shm_t shm; odp_ticketlock_t mask_lock[NUM_SCHED_GRPS]; @@ -437,6 +437,20 @@ static int read_config_file(sched_global_t *sched) if (val == 0 || sched->config.num_spread == 1) sched->load_balance = 0; + str = "sched_basic.order_stash_size"; + if (!_odp_libconfig_lookup_int(str, &val)) { + _ODP_ERR("Config option '%s' not found.\n", str); + return -1; + } + + if (val > MAX_ORDERED_STASH || val < 0) { + _ODP_ERR("Bad value %s = %i [min: 0, max: %u]\n", str, val, MAX_ORDERED_STASH); + return -1; + } + + sched->config.order_stash_size = val; + _ODP_PRINT(" %s: %i\n", str, val); + /* Initialize default values for all queue types */ str = "sched_basic.burst_size_default"; if (read_burst_size_conf(sched->config.burst_default[ODP_SCHED_SYNC_ATOMIC], str, 1, @@ -1204,7 +1218,7 @@ static int schedule_ord_enq_multi(odp_queue_t dst_queue, void *event_hdr[], /* Pktout may drop packets, so the operation cannot be stashed. */ if (dst_qentry->pktout.pktio != ODP_PKTIO_INVALID || - odp_unlikely(stash_num >= MAX_ORDERED_STASH)) { + odp_unlikely(stash_num >= sched->config.order_stash_size)) { /* If the local stash is full, wait until it is our turn and * then release the stash and do enqueue directly. */ wait_for_order(src_queue); diff --git a/platform/linux-generic/test/inline-timer.conf b/platform/linux-generic/test/inline-timer.conf index 261aa0141..5afcad2cb 100644 --- a/platform/linux-generic/test/inline-timer.conf +++ b/platform/linux-generic/test/inline-timer.conf @@ -1,6 +1,6 @@ # Mandatory fields odp_implementation = "linux-generic" -config_file_version = "0.1.22" +config_file_version = "0.1.23" timer: { # Enable inline timer implementation diff --git a/platform/linux-generic/test/packet_align.conf b/platform/linux-generic/test/packet_align.conf index 8d2d00e63..9aa6109a6 100644 --- a/platform/linux-generic/test/packet_align.conf +++ b/platform/linux-generic/test/packet_align.conf @@ -1,6 +1,6 @@ # Mandatory fields odp_implementation = "linux-generic" -config_file_version = "0.1.22" +config_file_version = "0.1.23" pool: { pkt: { diff --git a/platform/linux-generic/test/process-mode.conf b/platform/linux-generic/test/process-mode.conf index 1e0e7cc95..cf32fb86d 100644 --- a/platform/linux-generic/test/process-mode.conf +++ b/platform/linux-generic/test/process-mode.conf @@ -1,6 +1,6 @@ # Mandatory fields odp_implementation = "linux-generic" -config_file_version = "0.1.22" +config_file_version = "0.1.23" # Shared memory options shm: { diff --git a/platform/linux-generic/test/sched-basic.conf b/platform/linux-generic/test/sched-basic.conf index e63ffa2f3..5710c43c4 100644 --- a/platform/linux-generic/test/sched-basic.conf +++ b/platform/linux-generic/test/sched-basic.conf @@ -1,9 +1,10 @@ # Mandatory fields odp_implementation = "linux-generic" -config_file_version = "0.1.22" +config_file_version = "0.1.23" # Test scheduler with an odd spread value and without dynamic load balance sched_basic: { prio_spread = 3 load_balance = 0 + order_stash_size = 0 } |