[v4,8/8] sched: Add selftest for SHARED_RUNQ

Message ID 20231212003141.216236-9-void@manifault.com
State New
Headers
Series sched: Implement shared runqueue in fair.c |

Commit Message

David Vernet Dec. 12, 2023, 12:31 a.m. UTC
  We want to ensure that SHARED_RUNQ works as expected. Let's add a
testcase to the sched/ subdirectory containing SHARED_RUNQ which enables
and disables it in a loop, while stressing the system with rcutorture.

Cc: Aboorva Devarajan <aboorvad@linux.vnet.ibm.com>
Signed-off-by: David Vernet <void@manifault.com>
---
 tools/testing/selftests/sched/Makefile    |  5 ++++-
 tools/testing/selftests/sched/config      |  2 ++
 tools/testing/selftests/sched/test-swq.sh | 23 +++++++++++++++++++++++
 3 files changed, 29 insertions(+), 1 deletion(-)
 create mode 100755 tools/testing/selftests/sched/test-swq.sh
  

Patch

diff --git a/tools/testing/selftests/sched/Makefile b/tools/testing/selftests/sched/Makefile
index 099ee9213557..22f4941ff76b 100644
--- a/tools/testing/selftests/sched/Makefile
+++ b/tools/testing/selftests/sched/Makefile
@@ -9,6 +9,9 @@  CFLAGS += -O2 -Wall -g -I./ $(KHDR_INCLUDES) -Wl,-rpath=./ \
 LDLIBS += -lpthread
 
 TEST_GEN_FILES := cs_prctl_test
-TEST_PROGS := cs_prctl_test
+TEST_PROGS := \
+	cs_prctl_test \
+	test-srq.sh
+
 
 include ../lib.mk
diff --git a/tools/testing/selftests/sched/config b/tools/testing/selftests/sched/config
index e8b09aa7c0c4..6e1cbdb6eec3 100644
--- a/tools/testing/selftests/sched/config
+++ b/tools/testing/selftests/sched/config
@@ -1 +1,3 @@ 
 CONFIG_SCHED_DEBUG=y
+CONFIG_DEBUG_KERNEL=y
+CONFIG_RCU_TORTURE_TEST=m
diff --git a/tools/testing/selftests/sched/test-swq.sh b/tools/testing/selftests/sched/test-swq.sh
new file mode 100755
index 000000000000..547088840a6c
--- /dev/null
+++ b/tools/testing/selftests/sched/test-swq.sh
@@ -0,0 +1,23 @@ 
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (C) 2023 Meta, Inc
+
+echo "TEST: SHARED_RUNQ stress test ..."
+
+modprobe rcutorture
+
+for i in {1..10}; do
+	echo "Beginning iteration $i"
+	echo "SHARED_RUNQ" > /sys/kernel/debug/sched/features
+	sleep 2.3
+	echo "NO_SHARED_RUNQ" > /sys/kernel/debug/sched/features
+	sleep .8
+	echo "Completed iteration $i"
+	echo ""
+done
+
+rmmod rcutorture
+
+echo "DONE: SHARED_RUNQ stress test completed"
+
+exit 0