Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sched_deadline, docs: replace rt-app examples with chrt or use config.json

rt-app no longer accepts command-line arguments. So, replace rt-app example
with chrt and use the JSON format in the other example instead of command-
line arguments.

Signed-off-by: Shashank Balaji <shashank.mahadasyam@sony.com>
Reviewed-by: Juri Lelli <juri.lelli@redhat.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Link: https://lore.kernel.org/r/20250527-sched-deadline-cpu-affinity-v2-1-b8b40a4feefa@sony.com

authored by

Shashank Balaji and committed by
Jonathan Corbet
ab8531cd c361f76d

+30 -18
+30 -18
Documentation/scheduler/sched-deadline.rst
··· 678 678 5.1 SCHED_DEADLINE and cpusets HOWTO 679 679 ------------------------------------ 680 680 681 - An example of a simple configuration (pin a -deadline task to CPU0) 682 - follows (rt-app is used to create a -deadline task):: 681 + An example of a simple configuration (pin a -deadline task to CPU0) follows:: 683 682 684 683 mkdir /dev/cpuset 685 684 mount -t cgroup -o cpuset cpuset /dev/cpuset ··· 691 692 echo 1 > cpu0/cpuset.cpu_exclusive 692 693 echo 1 > cpu0/cpuset.mem_exclusive 693 694 echo $$ > cpu0/tasks 694 - rt-app -t 100000:10000:d:0 -D5 # it is now actually superfluous to specify 695 - # task affinity 695 + chrt --sched-runtime 100000 --sched-period 200000 --deadline 0 yes > /dev/null 696 696 697 697 6. Future plans 698 698 =============== ··· 729 731 behaves under such workloads. In this way, results are easily reproducible. 730 732 rt-app is available at: https://github.com/scheduler-tools/rt-app. 731 733 732 - Thread parameters can be specified from the command line, with something like 733 - this:: 734 + rt-app does not accept command line arguments, and instead reads from a JSON 735 + configuration file. Here is an example ``config.json``: 734 736 735 - # rt-app -t 100000:10000:d -t 150000:20000:f:10 -D5 737 + .. code-block:: json 736 738 737 - The above creates 2 threads. The first one, scheduled by SCHED_DEADLINE, 738 - executes for 10ms every 100ms. The second one, scheduled at SCHED_FIFO 739 - priority 10, executes for 20ms every 150ms. The test will run for a total 740 - of 5 seconds. 739 + { 740 + "tasks": { 741 + "dl_task": { 742 + "policy": "SCHED_DEADLINE", 743 + "priority": 0, 744 + "dl-runtime": 10000, 745 + "dl-period": 100000, 746 + "dl-deadline": 100000 747 + }, 748 + "fifo_task": { 749 + "policy": "SCHED_FIFO", 750 + "priority": 10, 751 + "runtime": 20000, 752 + "sleep": 130000 753 + } 754 + }, 755 + "global": { 756 + "duration": 5 757 + } 758 + } 741 759 742 - More interestingly, configurations can be described with a json file that 743 - can be passed as input to rt-app with something like this:: 760 + On running ``rt-app config.json``, it creates 2 threads. The first one, 761 + scheduled by SCHED_DEADLINE, executes for 10ms every 100ms. The second one, 762 + scheduled at SCHED_FIFO priority 10, executes for 20ms every 150ms. The test 763 + will run for a total of 5 seconds. 744 764 745 - # rt-app my_config.json 746 - 747 - The parameters that can be specified with the second method are a superset 748 - of the command line options. Please refer to rt-app documentation for more 749 - details (`<rt-app-sources>/doc/*.json`). 765 + Please refer to the rt-app documentation for the JSON schema and more examples. 750 766 751 767 The second testing application is done using chrt which has support 752 768 for SCHED_DEADLINE.