Commit 6b51c7e
committed
cgroup/cpuset: Always use cpu_active_mask
JIRA: https://issues.redhat.com/browse/RHEL-107751
commit 7a0aabd
Author: Waiman Long <longman@redhat.com>
Date: Mon, 7 Apr 2025 17:21:03 -0400
cgroup/cpuset: Always use cpu_active_mask
The current cpuset code uses both cpu_active_mask and cpu_online_mask
and it can be confusing which one should be used if we need to update
the code.
The top_cpuset is always synchronized to cpu_active_mask and we should
avoid using cpu_online_mask as much as possible. An active CPU is always
an online CPU, but not vice versa. cpu_active_mask and cpu_online_mask
can differ during hotplug operations.
A CPU is marked active at the last stage of CPU bringup (CPUHP_AP_ACTIVE).
It is also the stage where cpuset hotplug code will be called to update
the sched domains so that the scheduler can move a normal task to a
newly active CPU or remove tasks away from a newly inactivated CPU. The
online bit is set much earlier in the CPU bringup process and cleared
much later in CPU teardown.
If cpu_online_mask is used while a hotunplug operation is happening in
parallel, we may leave an offline CPU in cpu_allowed or have a higher
chance of leaving an offline CPU in some other masks. Avoid this
problem by always using cpu_active_mask in the cpuset code and leave
a comment as to why the use of cpu_online_mask is discouraged.
Signed-off-by: Waiman Long <longman@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Waiman Long <longman@redhat.com>1 parent c9dadee commit 6b51c7e
1 file changed
+23
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
195 | 209 | | |
196 | 210 | | |
197 | 211 | | |
| |||
355 | 369 | | |
356 | 370 | | |
357 | 371 | | |
358 | | - | |
| 372 | + | |
359 | 373 | | |
360 | 374 | | |
361 | 375 | | |
362 | | - | |
| 376 | + | |
363 | 377 | | |
364 | 378 | | |
365 | 379 | | |
366 | 380 | | |
367 | 381 | | |
368 | | - | |
369 | | - | |
| 382 | + | |
| 383 | + | |
370 | 384 | | |
371 | 385 | | |
372 | 386 | | |
| |||
2286 | 2300 | | |
2287 | 2301 | | |
2288 | 2302 | | |
2289 | | - | |
| 2303 | + | |
2290 | 2304 | | |
2291 | 2305 | | |
2292 | 2306 | | |
| |||
3105 | 3119 | | |
3106 | 3120 | | |
3107 | 3121 | | |
3108 | | - | |
| 3122 | + | |
3109 | 3123 | | |
3110 | 3124 | | |
3111 | 3125 | | |
| |||
4049 | 4063 | | |
4050 | 4064 | | |
4051 | 4065 | | |
4052 | | - | |
| 4066 | + | |
4053 | 4067 | | |
4054 | 4068 | | |
4055 | 4069 | | |
| |||
4063 | 4077 | | |
4064 | 4078 | | |
4065 | 4079 | | |
4066 | | - | |
| 4080 | + | |
4067 | 4081 | | |
4068 | 4082 | | |
4069 | 4083 | | |
| |||
4077 | 4091 | | |
4078 | 4092 | | |
4079 | 4093 | | |
4080 | | - | |
| 4094 | + | |
4081 | 4095 | | |
4082 | 4096 | | |
4083 | 4097 | | |
| |||
0 commit comments