linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] sched_deadline, docs: update rt-app examples, add cgroup v2 cpuset HOWTO
@ 2025-05-27 14:55 Shashank Balaji
  2025-05-27 14:55 ` [PATCH v2 1/2] sched_deadline, docs: replace rt-app examples with chrt or use config.json Shashank Balaji
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Shashank Balaji @ 2025-05-27 14:55 UTC (permalink / raw)
  To: Jonathan Corbet, Juri Lelli, Peter Zijlstra
  Cc: linux-doc, linux-kernel, Shinya Takumi, Shashank Balaji

The main goal of this patchset is to add the cgroup v2 cpuset controller HOWTO.
In v1 of this series, Juri commented that rt-app no longer takes command-line
options. So I ended up converting the rt-app examples to either use chrt instead
or use config.json.

Signed-off-by: Shashank Balaji <shashank.mahadasyam@sony.com>
---
Changes in v2:
- update rt-app examples to either use a chrt example or use config.json
- Link to v1: https://lore.kernel.org/r/20250522-sched-deadline-cpu-affinity-v1-1-2172c683acac@sony.com

---
Shashank Balaji (2):
      sched_deadline, docs: replace rt-app examples with chrt or use config.json
      sched_deadline, docs: add affinity setting with cgroup2 cpuset controller

 Documentation/scheduler/sched-deadline.rst | 77 ++++++++++++++++++++----------
 1 file changed, 53 insertions(+), 24 deletions(-)
---
base-commit: 914873bc7df913db988284876c16257e6ab772c6
change-id: 20250522-sched-deadline-cpu-affinity-b0b4edf0ddc9

Best regards,
-- 
Shashank Balaji <shashank.mahadasyam@sony.com>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 1/2] sched_deadline, docs: replace rt-app examples with chrt or use config.json
  2025-05-27 14:55 [PATCH v2 0/2] sched_deadline, docs: update rt-app examples, add cgroup v2 cpuset HOWTO Shashank Balaji
@ 2025-05-27 14:55 ` Shashank Balaji
  2025-05-27 14:55 ` [PATCH v2 2/2] sched_deadline, docs: add affinity setting with cgroup2 cpuset controller Shashank Balaji
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Shashank Balaji @ 2025-05-27 14:55 UTC (permalink / raw)
  To: Jonathan Corbet, Juri Lelli, Peter Zijlstra
  Cc: linux-doc, linux-kernel, Shinya Takumi, Shashank Balaji

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>
---
 Documentation/scheduler/sched-deadline.rst | 48 +++++++++++++++++++-----------
 1 file changed, 30 insertions(+), 18 deletions(-)

diff --git a/Documentation/scheduler/sched-deadline.rst b/Documentation/scheduler/sched-deadline.rst
index a727827b8dd52710f880c2b92d3a8224c259873c..b7aa96b0a02576311ce8fafc51b8b6949760927a 100644
--- a/Documentation/scheduler/sched-deadline.rst
+++ b/Documentation/scheduler/sched-deadline.rst
@@ -678,8 +678,7 @@ Deadline Task Scheduling
 5.1 SCHED_DEADLINE and cpusets HOWTO
 ------------------------------------
 
- An example of a simple configuration (pin a -deadline task to CPU0)
- follows (rt-app is used to create a -deadline task)::
+ An example of a simple configuration (pin a -deadline task to CPU0) follows::
 
    mkdir /dev/cpuset
    mount -t cgroup -o cpuset cpuset /dev/cpuset
@@ -692,8 +691,7 @@ Deadline Task Scheduling
    echo 1 > cpu0/cpuset.cpu_exclusive
    echo 1 > cpu0/cpuset.mem_exclusive
    echo $$ > cpu0/tasks
-   rt-app -t 100000:10000:d:0 -D5 # it is now actually superfluous to specify
-				  # task affinity
+   chrt --sched-runtime 100000 --sched-period 200000 --deadline 0 yes > /dev/null
 
 6. Future plans
 ===============
@@ -731,24 +729,38 @@ Appendix A. Test suite
  behaves under such workloads. In this way, results are easily reproducible.
  rt-app is available at: https://github.com/scheduler-tools/rt-app.
 
- Thread parameters can be specified from the command line, with something like
- this::
+ rt-app does not accept command line arguments, and instead reads from a JSON
+ configuration file. Here is an example ``config.json``:
 
-  # rt-app -t 100000:10000:d -t 150000:20000:f:10 -D5
+ .. code-block:: json
 
- The above creates 2 threads. The first one, scheduled by SCHED_DEADLINE,
- executes for 10ms every 100ms. The second one, scheduled at SCHED_FIFO
- priority 10, executes for 20ms every 150ms. The test will run for a total
- of 5 seconds.
+  {
+    "tasks": {
+      "dl_task": {
+        "policy": "SCHED_DEADLINE",
+        "priority": 0,
+        "dl-runtime": 10000,
+        "dl-period": 100000,
+        "dl-deadline": 100000
+      },
+      "fifo_task": {
+        "policy": "SCHED_FIFO",
+        "priority": 10,
+        "runtime": 20000,
+        "sleep": 130000
+      }
+    },
+    "global": {
+      "duration": 5
+    }
+  }
 
- More interestingly, configurations can be described with a json file that
- can be passed as input to rt-app with something like this::
+ On running ``rt-app config.json``, it creates 2 threads. The first one,
+ scheduled by SCHED_DEADLINE, executes for 10ms every 100ms. The second one,
+ scheduled at SCHED_FIFO priority 10, executes for 20ms every 150ms. The test
+ will run for a total of 5 seconds.
 
-  # rt-app my_config.json
-
- The parameters that can be specified with the second method are a superset
- of the command line options. Please refer to rt-app documentation for more
- details (`<rt-app-sources>/doc/*.json`).
+ Please refer to the rt-app documentation for the JSON schema and more examples.
 
  The second testing application is done using chrt which has support
  for SCHED_DEADLINE.

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 2/2] sched_deadline, docs: add affinity setting with cgroup2 cpuset controller
  2025-05-27 14:55 [PATCH v2 0/2] sched_deadline, docs: update rt-app examples, add cgroup v2 cpuset HOWTO Shashank Balaji
  2025-05-27 14:55 ` [PATCH v2 1/2] sched_deadline, docs: replace rt-app examples with chrt or use config.json Shashank Balaji
@ 2025-05-27 14:55 ` Shashank Balaji
  2025-05-27 15:23 ` [PATCH v2 0/2] sched_deadline, docs: update rt-app examples, add cgroup v2 cpuset HOWTO Juri Lelli
  2025-06-09 21:02 ` Jonathan Corbet
  3 siblings, 0 replies; 5+ messages in thread
From: Shashank Balaji @ 2025-05-27 14:55 UTC (permalink / raw)
  To: Jonathan Corbet, Juri Lelli, Peter Zijlstra
  Cc: linux-doc, linux-kernel, Shinya Takumi, Shashank Balaji

Setting the cpu affinity mask of a SCHED_DEADLINE process using the cgroup v1
cpuset controller is already detailed. Add similar information for cgroup v2's
cpuset controller.

Signed-off-by: Shashank Balaji <shashank.mahadasyam@sony.com>
---
 Documentation/scheduler/sched-deadline.rst | 29 +++++++++++++++++++++++------
 1 file changed, 23 insertions(+), 6 deletions(-)

diff --git a/Documentation/scheduler/sched-deadline.rst b/Documentation/scheduler/sched-deadline.rst
index b7aa96b0a02576311ce8fafc51b8b6949760927a..ec543a12f848e9d7215cc72c6068cf7b6b925dd8 100644
--- a/Documentation/scheduler/sched-deadline.rst
+++ b/Documentation/scheduler/sched-deadline.rst
@@ -20,7 +20,8 @@ Deadline Task Scheduling
       4.3 Default behavior
       4.4 Behavior of sched_yield()
     5. Tasks CPU affinity
-      5.1 SCHED_DEADLINE and cpusets HOWTO
+      5.1 Using cgroup v1 cpuset controller
+      5.2 Using cgroup v2 cpuset controller
     6. Future plans
     A. Test suite
     B. Minimal main()
@@ -671,12 +672,15 @@ Deadline Task Scheduling
 5. Tasks CPU affinity
 =====================
 
- -deadline tasks cannot have an affinity mask smaller that the entire
- root_domain they are created on. However, affinities can be specified
- through the cpuset facility (Documentation/admin-guide/cgroup-v1/cpusets.rst).
+ Deadline tasks cannot have a cpu affinity mask smaller than the root domain they
+ are created on. So, using ``sched_setaffinity(2)`` won't work. Instead, the
+ the deadline task should be created in a restricted root domain. This can be
+ done using the cpuset controller of either cgroup v1 (deprecated) or cgroup v2.
+ See :ref:`Documentation/admin-guide/cgroup-v1/cpusets.rst <cpusets>` and
+ :ref:`Documentation/admin-guide/cgroup-v2.rst <cgroup-v2>` for more information.
 
-5.1 SCHED_DEADLINE and cpusets HOWTO
-------------------------------------
+5.1 Using cgroup v1 cpuset controller
+-------------------------------------
 
  An example of a simple configuration (pin a -deadline task to CPU0) follows::
 
@@ -693,6 +697,19 @@ Deadline Task Scheduling
    echo $$ > cpu0/tasks
    chrt --sched-runtime 100000 --sched-period 200000 --deadline 0 yes > /dev/null
 
+5.2 Using cgroup v2 cpuset controller
+-------------------------------------
+
+ Assuming the cgroup v2 root is mounted at ``/sys/fs/cgroup``.
+
+   cd /sys/fs/cgroup
+   echo '+cpuset' > cgroup.subtree_control
+   mkdir deadline_group
+   echo 0 > deadline_group/cpuset.cpus
+   echo 'root' > deadline_group/cpuset.cpus.partition
+   echo $$ > deadline_group/cgroup.procs
+   chrt --sched-runtime 100000 --sched-period 200000 --deadline 0 yes > /dev/null
+
 6. Future plans
 ===============
 

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 0/2] sched_deadline, docs: update rt-app examples, add cgroup v2 cpuset HOWTO
  2025-05-27 14:55 [PATCH v2 0/2] sched_deadline, docs: update rt-app examples, add cgroup v2 cpuset HOWTO Shashank Balaji
  2025-05-27 14:55 ` [PATCH v2 1/2] sched_deadline, docs: replace rt-app examples with chrt or use config.json Shashank Balaji
  2025-05-27 14:55 ` [PATCH v2 2/2] sched_deadline, docs: add affinity setting with cgroup2 cpuset controller Shashank Balaji
@ 2025-05-27 15:23 ` Juri Lelli
  2025-06-09 21:02 ` Jonathan Corbet
  3 siblings, 0 replies; 5+ messages in thread
From: Juri Lelli @ 2025-05-27 15:23 UTC (permalink / raw)
  To: Shashank Balaji
  Cc: Jonathan Corbet, Peter Zijlstra, linux-doc, linux-kernel,
	Shinya Takumi

Hi!

On 27/05/25 23:55, Shashank Balaji wrote:
> The main goal of this patchset is to add the cgroup v2 cpuset controller HOWTO.
> In v1 of this series, Juri commented that rt-app no longer takes command-line
> options. So I ended up converting the rt-app examples to either use chrt instead
> or use config.json.
> 
> Signed-off-by: Shashank Balaji <shashank.mahadasyam@sony.com>
> ---
> Changes in v2:
> - update rt-app examples to either use a chrt example or use config.json
> - Link to v1: https://lore.kernel.org/r/20250522-sched-deadline-cpu-affinity-v1-1-2172c683acac@sony.com
> 
> ---
> Shashank Balaji (2):
>       sched_deadline, docs: replace rt-app examples with chrt or use config.json
>       sched_deadline, docs: add affinity setting with cgroup2 cpuset controller
> 
>  Documentation/scheduler/sched-deadline.rst | 77 ++++++++++++++++++++----------
>  1 file changed, 53 insertions(+), 24 deletions(-)

Looks good to me, thanks!

Reviewed-by: Juri Lelli <juri.lelli@redhat.com>

Best,
Juri


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 0/2] sched_deadline, docs: update rt-app examples, add cgroup v2 cpuset HOWTO
  2025-05-27 14:55 [PATCH v2 0/2] sched_deadline, docs: update rt-app examples, add cgroup v2 cpuset HOWTO Shashank Balaji
                   ` (2 preceding siblings ...)
  2025-05-27 15:23 ` [PATCH v2 0/2] sched_deadline, docs: update rt-app examples, add cgroup v2 cpuset HOWTO Juri Lelli
@ 2025-06-09 21:02 ` Jonathan Corbet
  3 siblings, 0 replies; 5+ messages in thread
From: Jonathan Corbet @ 2025-06-09 21:02 UTC (permalink / raw)
  To: Shashank Balaji, Juri Lelli, Peter Zijlstra
  Cc: linux-doc, linux-kernel, Shinya Takumi, Shashank Balaji

Shashank Balaji <shashank.mahadasyam@sony.com> writes:

> The main goal of this patchset is to add the cgroup v2 cpuset controller HOWTO.
> In v1 of this series, Juri commented that rt-app no longer takes command-line
> options. So I ended up converting the rt-app examples to either use chrt instead
> or use config.json.
>
> Signed-off-by: Shashank Balaji <shashank.mahadasyam@sony.com>
> ---
> Changes in v2:
> - update rt-app examples to either use a chrt example or use config.json
> - Link to v1: https://lore.kernel.org/r/20250522-sched-deadline-cpu-affinity-v1-1-2172c683acac@sony.com
>

Applied, thanks.

jon

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-06-09 21:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-27 14:55 [PATCH v2 0/2] sched_deadline, docs: update rt-app examples, add cgroup v2 cpuset HOWTO Shashank Balaji
2025-05-27 14:55 ` [PATCH v2 1/2] sched_deadline, docs: replace rt-app examples with chrt or use config.json Shashank Balaji
2025-05-27 14:55 ` [PATCH v2 2/2] sched_deadline, docs: add affinity setting with cgroup2 cpuset controller Shashank Balaji
2025-05-27 15:23 ` [PATCH v2 0/2] sched_deadline, docs: update rt-app examples, add cgroup v2 cpuset HOWTO Juri Lelli
2025-06-09 21:02 ` Jonathan Corbet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).