From 84fa73eb5c595a6dcf98c14d6b20544f38db69c6 Mon Sep 17 00:00:00 2001 From: Tomasz Zawadzki Date: Fri, 3 Sep 2021 10:12:17 +0200 Subject: [PATCH] test/scheduler: wait for scheduler after thread creation in busy() All other tests wait for scheduling to occur before verifying the results. Even for 100% busy threads, they are first round robined between cores. In some edge cases, if threads are created right at the end of the scheduling period - they will be 100% busy. Yet due to low busy_tsc it will be deemed that two of such threads can be placed on single core. To prevent that a few full scheduling periods have to be observed. Thus added sleep for 10 scheduling periods before verifying the results, similar to other test cases in this file. While here increased the sleep time between samples to match the scheduling period. With 1 sec default scheduling period, no change would occur between two 0.5 sec samples. Fixes #2140 Signed-off-by: Tomasz Zawadzki Change-Id: I5abf3bc04c6f65f4faae2bcd3e6828be72f97311 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9387 Tested-by: SPDK CI Jenkins Reviewed-by: Konrad Sztyber Reviewed-by: Ben Walker Reviewed-by: Dong Yi Reviewed-by: Shuhei Matsumoto --- test/scheduler/load_balancing.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/scheduler/load_balancing.sh b/test/scheduler/load_balancing.sh index fee2347b1..de3466b5b 100755 --- a/test/scheduler/load_balancing.sh +++ b/test/scheduler/load_balancing.sh @@ -16,6 +16,7 @@ busy() { local selected_cpus cpu local reactor_framework local threads thread + local sched_period=1 # default, 1s # Create two busy threads with two cpus (not including main cpu) and check if either of # them is moved to either of the selected cpus. Expected load is ~100% on each thread and @@ -26,11 +27,13 @@ busy() { thread0=$(create_thread -n "thread0" -m "$(mask_cpus "${selected_cpus[@]}")" -a 100) thread1=$(create_thread -n "thread1" -m "$(mask_cpus "${selected_cpus[@]}")" -a 100) + sleep $((10 * sched_period)) + local samples=0 xtrace_disable while ((samples++ < 5)); do - sleep 0.5s + sleep $sched_period all_set=0 reactor_framework=$(rpc_cmd framework_get_reactors | jq -r '.reactors[]')