| 1 |
'\" t |
| 2 |
.\" Title: coresched |
| 3 |
.\" Author: [see the "AUTHOR(S)" section] |
| 4 |
.\" Generator: Asciidoctor 2.0.20 |
| 5 |
.\" Date: 2026-05-18 |
| 6 |
.\" Manual: User Commands |
| 7 |
.\" Source: util-linux 2.42.1 |
| 8 |
.\" Language: English |
| 9 |
.\" |
| 10 |
.TH "CORESCHED" "1" "2026-05-18" "util\-linux 2.42.1" "User Commands" |
| 11 |
.ie \n(.g .ds Aq \(aq |
| 12 |
.el .ds Aq ' |
| 13 |
.ss \n[.ss] 0 |
| 14 |
.nh |
| 15 |
.ad l |
| 16 |
.de URL |
| 17 |
\fI\\$2\fP <\\$1>\\$3 |
| 18 |
.. |
| 19 |
.als MTO URL |
| 20 |
.if \n[.g] \{\ |
| 21 |
. mso www.tmac |
| 22 |
. am URL |
| 23 |
. ad l |
| 24 |
. . |
| 25 |
. am MTO |
| 26 |
. ad l |
| 27 |
. . |
| 28 |
. LINKSTYLE blue R < > |
| 29 |
.\} |
| 30 |
.SH "NAME" |
| 31 |
coresched \- manage core scheduling cookies for tasks |
| 32 |
.SH "SYNOPSIS" |
| 33 |
.sp |
| 34 |
\fBcoresched\fP [\fBget\fP] [\fB\-s\fP \fIpid\fP] |
| 35 |
.sp |
| 36 |
\fBcoresched\fP \fBnew\fP [\fB\-t\fP \fItype\fP] \fB\-d\fP \fIpid\fP |
| 37 |
.sp |
| 38 |
\fBcoresched\fP \fBnew\fP [\fB\-t\fP \fItype\fP] \-\- \fIcommand\fP [\fIargument\fP...] |
| 39 |
.sp |
| 40 |
\fBcoresched\fP \fBcopy\fP [\fB\-s\fP \fIpid\fP] [\fB\-t\fP \fItype\fP] \fB\-d\fP \fIpid\fP |
| 41 |
.sp |
| 42 |
\fBcoresched\fP \fBcopy\fP [\fB\-s\fP \fIpid\fP] [\fB\-t\fP \fItype\fP] \-\- \fIcommand\fP [\fIargument\fP...] |
| 43 |
.SH "DESCRIPTION" |
| 44 |
.sp |
| 45 |
The \fBcoresched\fP command is used to retrieve or modify the core scheduling cookies of a running process given its \fIpid\fP, or to spawn a new \fIcommand\fP with core scheduling cookies. |
| 46 |
.sp |
| 47 |
Core scheduling permits the definition of groups of tasks that are allowed to share a physical core. |
| 48 |
This is done by assigning a cookie to each task. |
| 49 |
Only tasks have the same cookie are allowed to be scheduled on the same physical core. |
| 50 |
.sp |
| 51 |
It is possible to either assign a new random cookie to a task, or copy a cookie from another task. It is not possible to choose the value of the cookie. |
| 52 |
.SH "FUNCTIONS" |
| 53 |
.sp |
| 54 |
\fBget\fP |
| 55 |
.RS 4 |
| 56 |
Retrieve the core scheduling cookie of the PID specified in \fB\-s\fP. |
| 57 |
If \fB\-s\fP is omitted, it will get the cookie of the current \fBcoresched\fP process. |
| 58 |
.RE |
| 59 |
.sp |
| 60 |
\fBnew\fP |
| 61 |
.RS 4 |
| 62 |
Assign a new cookie to an existing PID specified in \fB\-d\fP, or execute \fIcommand\fP with a new cookie. |
| 63 |
.RE |
| 64 |
.sp |
| 65 |
\fBcopy\fP |
| 66 |
.RS 4 |
| 67 |
Copy the cookie from an existing PID (\fB\-s\fP) to another PID (\fB\-d\fP), or execute \fIcommand\fP with that cookie. |
| 68 |
If \fB\-s\fP is omitted, it will get the cookie of the current \fBcoresched\fP process. |
| 69 |
.RE |
| 70 |
.sp |
| 71 |
If no function is specified, it will run the \fBget\fP function. |
| 72 |
.SH "OPTIONS" |
| 73 |
.sp |
| 74 |
\fB\-s\fP, \fB\-\-source\fP \fIPID\fP |
| 75 |
.RS 4 |
| 76 |
Which \fIPID\fP to get the cookie from. |
| 77 |
If this option is omitted, it will get the cookie from the current \fBcoresched\fP process. |
| 78 |
.RE |
| 79 |
.sp |
| 80 |
\fB\-d\fP, \fB\-\-dest\fP \fIPID\fP |
| 81 |
.RS 4 |
| 82 |
Which \fIPID\fP to modify the cookie of. |
| 83 |
.RE |
| 84 |
.sp |
| 85 |
\fB\-t\fP, \fB\-\-dest\-type\fP \fITYPE\fP |
| 86 |
.RS 4 |
| 87 |
The type of the PID whose cookie will be modified. This can be one of three values: |
| 88 |
.sp |
| 89 |
.RS 4 |
| 90 |
.ie n \{\ |
| 91 |
\h'-04'\(bu\h'+03'\c |
| 92 |
.\} |
| 93 |
.el \{\ |
| 94 |
. sp -1 |
| 95 |
. IP \(bu 2.3 |
| 96 |
.\} |
| 97 |
\fBpid\fP, or process ID |
| 98 |
.RE |
| 99 |
.sp |
| 100 |
.RS 4 |
| 101 |
.ie n \{\ |
| 102 |
\h'-04'\(bu\h'+03'\c |
| 103 |
.\} |
| 104 |
.el \{\ |
| 105 |
. sp -1 |
| 106 |
. IP \(bu 2.3 |
| 107 |
.\} |
| 108 |
\fBtgid\fP, or thread group ID (default value) |
| 109 |
.RE |
| 110 |
.sp |
| 111 |
.RS 4 |
| 112 |
.ie n \{\ |
| 113 |
\h'-04'\(bu\h'+03'\c |
| 114 |
.\} |
| 115 |
.el \{\ |
| 116 |
. sp -1 |
| 117 |
. IP \(bu 2.3 |
| 118 |
.\} |
| 119 |
\fBpgid\fP, or process group ID |
| 120 |
.RE |
| 121 |
.RE |
| 122 |
.sp |
| 123 |
\fB\-v\fP, \fB\-\-verbose\fP |
| 124 |
.RS 4 |
| 125 |
Show extra information when modifying cookies of tasks. |
| 126 |
.RE |
| 127 |
.sp |
| 128 |
\fB\-h\fP, \fB\-\-help\fP |
| 129 |
.RS 4 |
| 130 |
Display help text and exit. |
| 131 |
.RE |
| 132 |
.sp |
| 133 |
\fB\-V\fP, \fB\-\-version\fP |
| 134 |
.RS 4 |
| 135 |
Display version and exit. |
| 136 |
.RE |
| 137 |
.SH "EXAMPLES" |
| 138 |
.sp |
| 139 |
Get the core scheduling cookie of the coresched task itself, usually inherited from its parent: |
| 140 |
.RS 4 |
| 141 |
\fBcoresched get\fP |
| 142 |
.RE |
| 143 |
.sp |
| 144 |
Get the core scheduling cookie of a task with PID \fI123\fP: |
| 145 |
.RS 4 |
| 146 |
\fBcoresched get \-s\fP \fI123\fP |
| 147 |
.RE |
| 148 |
.sp |
| 149 |
Give a task with PID \fI123\fP a new core scheduling cookie: |
| 150 |
.RS 4 |
| 151 |
\fBcoresched new \-d\fP \fI123\fP |
| 152 |
.RE |
| 153 |
.sp |
| 154 |
Spawn a new task with a new core scheduling cookie: |
| 155 |
.RS 4 |
| 156 |
\fBcoresched new\fP \-\- \fIcommand\fP [\fIargument\fP...] |
| 157 |
.RE |
| 158 |
.sp |
| 159 |
Copy the cookie from the current coresched process another task with pid \fI456\fP: |
| 160 |
.RS 4 |
| 161 |
\fBcoresched copy \-d\fP \fI456\fP |
| 162 |
.RE |
| 163 |
.sp |
| 164 |
Copy the cookie from a task with pid \fI123\fP to another task with pid \fI456\fP: |
| 165 |
.RS 4 |
| 166 |
\fBcoresched copy \-s\fP \fI123\fP \fB\-d\fP \fI456\fP |
| 167 |
.RE |
| 168 |
.sp |
| 169 |
Copy the cookie from a task with pid \fI123\fP to a new task \fIcommand\fP: |
| 170 |
.RS 4 |
| 171 |
\fBcoresched copy \-s\fP \fI123\fP \-\- \fIcommand\fP [\fIargument\fP...] |
| 172 |
.RE |
| 173 |
.sp |
| 174 |
Copy the cookie from a task with pid \fI123\fP to the process group ID \fI456\fP: |
| 175 |
.RS 4 |
| 176 |
\fBcoresched copy \-s\fP \fI123\fP \fB\-t\fP \fIpgid\fP \fB\-d\fP \fI456\fP |
| 177 |
.RE |
| 178 |
.SH "PERMISSIONS" |
| 179 |
.sp |
| 180 |
Retrieving or modifying the core scheduling cookie of a process requires \fBPTRACE_MODE_READ_REALCREDS\fP ptrace access to that process. |
| 181 |
See the section "Ptrace access mode checking" in \fBptrace\fP(2) for more information. |
| 182 |
.SH "EXIT STATUS" |
| 183 |
.sp |
| 184 |
On success, \fBcoresched\fP returns 0. |
| 185 |
If \fBcoresched\fP fails, it will print an error and return 1. |
| 186 |
.sp |
| 187 |
If a \fIcommand\fP is being executed, the return value of \fBcoresched\fP will be the return value of \fIcommand\fP. |
| 188 |
.SH "NOTES" |
| 189 |
.sp |
| 190 |
\fBcoresched\fP requires core scheduling support in the kernel. |
| 191 |
This can be enabled via the \fBCONFIG_SCHED_CORE\fP kernel config option. |
| 192 |
.SH "AUTHORS" |
| 193 |
.sp |
| 194 |
.MTO "thijs\(atraymakers.nl" "Thijs Raymakers" "," |
| 195 |
.MTO "pauld\(atredhat.com" "Phil Auld" "" |
| 196 |
.SH "COPYRIGHT" |
| 197 |
.sp |
| 198 |
Copyright © 2024 Thijs Raymakers and Phil Auld. This is free software licensed under the EUPL. |
| 199 |
.SH "SEE ALSO" |
| 200 |
.sp |
| 201 |
\fBchrt\fP(1), |
| 202 |
\fBnice\fP(1), |
| 203 |
\fBrenice\fP(1), |
| 204 |
\fBtaskset\fP(1), |
| 205 |
\fBptrace\fP(2), |
| 206 |
\fBsched\fP(7) |
| 207 |
.sp |
| 208 |
The Linux kernel source files \fIDocumentation/admin\-guide/hw\-vuln/core\-scheduling.rst\fP |
| 209 |
.SH "REPORTING BUGS" |
| 210 |
.sp |
| 211 |
For bug reports, use the \c |
| 212 |
.URL "https://github.com/util\-linux/util\-linux/issues" "issue tracker" "." |
| 213 |
.SH "AVAILABILITY" |
| 214 |
.sp |
| 215 |
The \fBcoresched\fP command is part of the util\-linux package which can be downloaded from \c |
| 216 |
.URL "https://www.kernel.org/pub/linux/utils/util\-linux/" "Linux Kernel Archive" "." |