Commit 84fa73eb authored by Tomasz Zawadzki's avatar Tomasz Zawadzki
Browse files

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: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I5abf3bc04c6f65f4faae2bcd3e6828be72f97311
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9387


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarDong Yi <dongx.yi@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
parent 0c106d2b
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -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[]')