From nobody Fri Dec 19 21:12:09 2025 Received: from jpms-ob01.noc.sony.co.jp (jpms-ob01.noc.sony.co.jp [211.125.140.164]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4321F2798EB; Tue, 27 May 2025 14:56:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.125.140.164 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748357771; cv=none; b=S2PesJdGnIO81QDTpbuB1V9PZzNUaYotqQmRXdbbwWDq9Yr4UwPQ28xZfLSlMwfGyxLvIGo9t6iMHKHoZhkuZBmfi9Mxu8+OYqlc8i5y2l10kcZwSBAAjMi6qaMwzRskmvrEoI/0Yv/Abp+r7d631wkjECcyJKdTCRso54ezGsE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748357771; c=relaxed/simple; bh=t09Z5CcPNsYhzB2DxpAVxkfOFuQjUTPqnqfcV3KtAyE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Q0voEIHeP6bTbyoE3ChQObEe96ekMYY3IribxBScaKBibXqKiXrl0NzypXDiprHl+Dlb2SwGwq7Jw1g2bUf8MTBIWmG8txP/ZmVnLLTWgXHRj1VvxQxaOYF/vqvOuW52Uw/9ne1Y4AXsKZVz6xf5k6sheEoUClnfj0ELyXpNYcw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sony.com; spf=pass smtp.mailfrom=sony.com; dkim=pass (2048-bit key) header.d=sony.com header.i=@sony.com header.b=JNq96kT7; arc=none smtp.client-ip=211.125.140.164 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sony.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sony.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sony.com header.i=@sony.com header.b="JNq96kT7" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sony.com; s=s1jp; t=1748357768; x=1779893768; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=1B77FQV8y43cy3gheZ3TuKMjJM1UlUmYPoM7OCb+594=; b=JNq96kT7Y4adU9zT9aFTe3t9a7NkeRvx+PVlBvROtEyZS8oHM1eYrEvh YG+BVkzSAW6JsAeyxqRnF4GB1Eeb7XsBF0MCkGkfcKcJIrqyaUgbQtyxf DHLfhm92JQywrTYl7MZHVyGQc6oRTyr93HG15bN+Jc3GJZwH88qsklcsT wAKz34nCHN55hQc+zQ/5TBDrCkb5p5lhO3W3LjqTU+qW1OJ+O3ZxcG1yc o++cpj6GjQMGbM1Edg+BVc3CnxaYv8vsGzoqM2hq9FUM5W8jhUsI8oeS6 ehfi1hJ9BfgWHF5lu4vDSi9YAcmMUYrkZjPIyIu22ayfySqPqYN1XALb1 g==; Received: from unknown (HELO jpmta-ob02.noc.sony.co.jp) ([IPv6:2001:cf8:0:6e7::7]) by jpms-ob01.noc.sony.co.jp with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 May 2025 23:56:03 +0900 X-IronPort-AV: E=Sophos;i="6.15,318,1739804400"; d="scan'208";a="534627492" Received: from unknown (HELO [127.0.1.1]) ([IPv6:2001:cf8:1:573:0:dddd:6b3e:119e]) by jpmta-ob02.noc.sony.co.jp with ESMTP; 27 May 2025 23:56:03 +0900 From: Shashank Balaji Date: Tue, 27 May 2025 23:55:57 +0900 Subject: [PATCH v2 1/2] sched_deadline, docs: replace rt-app examples with chrt or use config.json Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250527-sched-deadline-cpu-affinity-v2-1-b8b40a4feefa@sony.com> References: <20250527-sched-deadline-cpu-affinity-v2-0-b8b40a4feefa@sony.com> In-Reply-To: <20250527-sched-deadline-cpu-affinity-v2-0-b8b40a4feefa@sony.com> To: Jonathan Corbet , Juri Lelli , Peter Zijlstra Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Shinya Takumi , Shashank Balaji X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3489; i=shashank.mahadasyam@sony.com; h=from:subject:message-id; bh=t09Z5CcPNsYhzB2DxpAVxkfOFuQjUTPqnqfcV3KtAyE=; b=owGbwMvMwCV2mPH4Ij++H1mMp9WSGDJMLzWVPhZfODVoq2Sz9uKiGI6Pr86znjZfm/LR1kawf AbXUtm5HaUsDGJcDLJiiizvZNZdOGhl2fT1OMM3mDmsTCBDGLg4BWAi568y/C+56FLPJR7Yf9K7 maV/+wu59MmdBczfdjsvWn1R9sGrV42MDJNVsw13PmljnGw2dc2O4HX3d291k5HKkp1z4uXBR9G 3gzkB X-Developer-Key: i=shashank.mahadasyam@sony.com; a=openpgp; fpr=EE1CAED0C13A3982F5C700F6C301C7A24E0EF86A 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 Reviewed-by: Juri Lelli --- Documentation/scheduler/sched-deadline.rst | 48 +++++++++++++++++++-------= ---- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/Documentation/scheduler/sched-deadline.rst b/Documentation/sch= eduler/sched-deadline.rst index a727827b8dd52710f880c2b92d3a8224c259873c..b7aa96b0a02576311ce8fafc51b= 8b6949760927a 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 ------------------------------------ =20 - 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) follo= ws:: =20 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 spec= ify - # task affinity + chrt --sched-runtime 100000 --sched-period 200000 --deadline 0 yes > /d= ev/null =20 6. Future plans =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D @@ -731,24 +729,38 @@ Appendix A. Test suite behaves under such workloads. In this way, results are easily reproducibl= e. rt-app is available at: https://github.com/scheduler-tools/rt-app. =20 - 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 J= SON + configuration file. Here is an example ``config.json``: =20 - # rt-app -t 100000:10000:d -t 150000:20000:f:10 -D5 + .. code-block:: json =20 - 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 + } + } =20 - 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 on= e, + scheduled at SCHED_FIFO priority 10, executes for 20ms every 150ms. The t= est + will run for a total of 5 seconds. =20 - # 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 (`/doc/*.json`). + Please refer to the rt-app documentation for the JSON schema and more exa= mples. =20 The second testing application is done using chrt which has support for SCHED_DEADLINE. --=20 2.43.0 From nobody Fri Dec 19 21:12:09 2025 Received: from jpms-ob01.noc.sony.co.jp (jpms-ob01.noc.sony.co.jp [211.125.140.164]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9EB2027991C; Tue, 27 May 2025 14:56:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.125.140.164 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748357772; cv=none; b=D6SS+mAOWCoCvs7m+CDpl1WpLu/LTmlXaxoui/RVf0S9aCVtwzBlgDcu+PHm7u1cP5/z/jdoZ1XAocHnfuR2T7DC+7ddPuX+ybJL+Cn6aeORju3kLCpbvz1EJ7RrKz/ePMvtOw2J4RBOT/s4n5dL6NLsh0FfZ+dQJT2t5qBxLMU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748357772; c=relaxed/simple; bh=3Wt+EHWz5IG03k3cQmX9fUctjhkN2uTFxGyrUjfglPI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bDYterhHnE4cjNptvlqLaINmWt0SDxwoAUfHgkk/BzwCzSZwa54HcZgm6EEfM7GG2YVIWVOkBg4jDdOz8AbjUURopUomzhcrb7DX2p+rqSsWfA+Ai5nY7Y7czhHwBBrEX2rwl3FXT0Br2DKq9tlSVeGy4MaR7DHmP/9aW+NJ92c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sony.com; spf=pass smtp.mailfrom=sony.com; dkim=pass (2048-bit key) header.d=sony.com header.i=@sony.com header.b=ZZEvRtkU; arc=none smtp.client-ip=211.125.140.164 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sony.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sony.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sony.com header.i=@sony.com header.b="ZZEvRtkU" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sony.com; s=s1jp; t=1748357770; x=1779893770; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=b06uT2xm22NJ6tJenPUmaXQ8h1Dezkkzes2Hwvoxh0A=; b=ZZEvRtkUIYETsefS4UnwoWpfTZowc++jpTqh2K3hHq8/tefKx/tP/hOW RcwJ8c2zPjQl3qt6xfaE1iFbI5VlcGParLY/zFednQm/DARmn33rW7eWB xnaUDpwq1cZTJBqRdrTLdrLUUW20l6q/VugczEAA3lvfDFlPnZF0nMDeN qzxMkWHddlaK+xXRQrR08EL4niDNJ3EyDOAahxxlU1YTc8derCrTZOCo2 8Etaxr6JxijBsfWciRM13cUpRFyoMYmp2olrVFQsXt/HEzX4kxgCJkA2H qOhk2rUxvX8dyjsJTV63y0skHisyDIWe4OLJgsuExD6GBjSIN2F1L+Xoz g==; Received: from unknown (HELO jpmta-ob02.noc.sony.co.jp) ([IPv6:2001:cf8:0:6e7::7]) by jpms-ob01.noc.sony.co.jp with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 May 2025 23:56:03 +0900 X-IronPort-AV: E=Sophos;i="6.15,318,1739804400"; d="scan'208";a="534627493" Received: from unknown (HELO [127.0.1.1]) ([IPv6:2001:cf8:1:573:0:dddd:6b3e:119e]) by jpmta-ob02.noc.sony.co.jp with ESMTP; 27 May 2025 23:56:03 +0900 From: Shashank Balaji Date: Tue, 27 May 2025 23:55:58 +0900 Subject: [PATCH v2 2/2] sched_deadline, docs: add affinity setting with cgroup2 cpuset controller Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250527-sched-deadline-cpu-affinity-v2-2-b8b40a4feefa@sony.com> References: <20250527-sched-deadline-cpu-affinity-v2-0-b8b40a4feefa@sony.com> In-Reply-To: <20250527-sched-deadline-cpu-affinity-v2-0-b8b40a4feefa@sony.com> To: Jonathan Corbet , Juri Lelli , Peter Zijlstra Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Shinya Takumi , Shashank Balaji X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2769; i=shashank.mahadasyam@sony.com; h=from:subject:message-id; bh=3Wt+EHWz5IG03k3cQmX9fUctjhkN2uTFxGyrUjfglPI=; b=owGbwMvMwCV2mPH4Ij++H1mMp9WSGDJMLzXLXLSbeX/yv1VxzudeZZ5fz1aiWOtY0HX7YPDlH j3mMNP/HaUsDGJcDLJiiizvZNZdOGhl2fT1OMM3mDmsTCBDGLg4BWAi744x/K8QqBaJequ3U56H sSzeaGZK1Qz5hhNeLwQ/O6dc9Cz3m8nI8GbjO3c3q69sqdOcVh0PVw9ZZ9Ey519v8aYftywXTFt qzQYA X-Developer-Key: i=shashank.mahadasyam@sony.com; a=openpgp; fpr=EE1CAED0C13A3982F5C700F6C301C7A24E0EF86A Setting the cpu affinity mask of a SCHED_DEADLINE process using the cgroup = v1 cpuset controller is already detailed. Add similar information for cgroup v= 2's cpuset controller. Signed-off-by: Shashank Balaji Reviewed-by: Juri Lelli --- Documentation/scheduler/sched-deadline.rst | 29 +++++++++++++++++++++++---= --- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/Documentation/scheduler/sched-deadline.rst b/Documentation/sch= eduler/sched-deadline.rst index b7aa96b0a02576311ce8fafc51b8b6949760927a..ec543a12f848e9d7215cc72c606= 8cf7b6b925dd8 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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 - -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 doma= in they + are created on. So, using ``sched_setaffinity(2)`` won't work. Instead, t= he + 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 cgro= up v2. + See :ref:`Documentation/admin-guide/cgroup-v1/cpusets.rst ` and + :ref:`Documentation/admin-guide/cgroup-v2.rst ` for more infor= mation. =20 -5.1 SCHED_DEADLINE and cpusets HOWTO ------------------------------------- +5.1 Using cgroup v1 cpuset controller +------------------------------------- =20 An example of a simple configuration (pin a -deadline task to CPU0) follo= ws:: =20 @@ -693,6 +697,19 @@ Deadline Task Scheduling echo $$ > cpu0/tasks chrt --sched-runtime 100000 --sched-period 200000 --deadline 0 yes > /d= ev/null =20 +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 > /d= ev/null + 6. Future plans =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 --=20 2.43.0