scheduler: Fix reverting CPU affinity in process groups
Previously CPU affinity of tasks created while Tuned was running was not correctly reverted on Tuned shutdown. Reproducer (on a 4 core machine): $ mkdir /etc/tuned/test $ cat > /etc/tuned/test/tuned.conf << EOF [scheduler] group.foo=0⭕0:1:a.out EOF $ cat > a.c << EOF #include <unistd.h> int main(void) { pause(); return 0; } EOF $ gcc a.c $ systemctl start tuned $ ./a.out & $ systemctl stop tuned $ taskset -p $(pgrep a.out) pid 9950's current affinity mask: 1 <<< should be "f" Known issue: if you run the above reproducer with the config below after this commit is applied, the affinity of the task after stopping tuned will be 0xd, not 0xf. This is because after starting tuned, first the affinity of the shell session is set to the non-isolated cores (0xd). Then when ./a.out starts, it inherits that affinity. Then when tuned tunes the affinity of the ./a.out process, it remembers 0xd as its old affinity rather than 0xf. It is unclear to me at this point whether we should do anything about this issue. Properly fixing it would require tracing where processes get their affinity from. [scheduler] group.foo=0⭕0:1:a.out ps_blacklist=.*a.out.* isolated_cores=1 Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
This commit is contained in:
parent
72c94b3614
commit
e511d70d40
1 changed files with 1 additions and 1 deletions
|
|
@ -284,7 +284,7 @@ class SchedulerPlugin(base.Plugin):
|
|||
for pid, vals in list(instance._scheduler_original.items()):
|
||||
# if command line for the pid didn't change, it's very probably the same process
|
||||
try:
|
||||
if ps[pid] == vals[0]:
|
||||
if ps[int(pid)] == vals[0]:
|
||||
self._set_rt(pid, self._sched2param(vals[1]), vals[2])
|
||||
self._set_affinity(pid, vals[3])
|
||||
except KeyError as e:
|
||||
|
|
|
|||
Loading…
Reference in a new issue