From: Shashank Balaji <shashank.mahadasyam@sony.com>
To: Jonathan Corbet <corbet@lwn.net>,
Juri Lelli <juri.lelli@redhat.com>,
Peter Zijlstra <peterz@infradead.org>
Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
Shinya Takumi <shinya.takumi@sony.com>,
Shashank Balaji <shashank.mahadasyam@sony.com>
Subject: [PATCH v2 2/2] sched_deadline, docs: add affinity setting with cgroup2 cpuset controller
Date: Tue, 27 May 2025 23:55:58 +0900 [thread overview]
Message-ID: <20250527-sched-deadline-cpu-affinity-v2-2-b8b40a4feefa@sony.com> (raw)
In-Reply-To: <20250527-sched-deadline-cpu-affinity-v2-0-b8b40a4feefa@sony.com>
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
next prev parent reply other threads:[~2025-05-27 14:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250527-sched-deadline-cpu-affinity-v2-2-b8b40a4feefa@sony.com \
--to=shashank.mahadasyam@sony.com \
--cc=corbet@lwn.net \
--cc=juri.lelli@redhat.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=shinya.takumi@sony.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®