Open matoro opened 8 months ago
Does this mean Process.nice()
is wrong or the test is wrong?
Should Process.nice()
behave differently and take into account group scheduling (how?)?
Does this mean
Process.nice()
is wrong or the test is wrong? ShouldProcess.nice()
behave differently and take into account group scheduling (how?)?
To be honest I'm not sure what the correct solution is, that's why I opened this as an issue rather than a PR. I think the only real issue here is with SCHED_IDLE
. From sched(7)
:
(Since Linux 2.6.23.) SCHED_IDLE can be used only at static priority 0; the process nice value has no influence for this policy. This policy is intended for running jobs at extremely low priority (lower even than a +19 nice value with the SCHED_OTHER or SCHED_BATCH policies).
Perhaps we should mirror ps(1)
logic and return None
or "-"
for any policy other than SCHED_OTHER
or SCHED_BATCH
?
Summary
Description
The following test fails when running under a non-realtime scheduling policy on Linux:
According to
sched(7)
:...
It would seem that
ps(1)
interprets this as thenice
value being wholly meaningless under such scheduling policies, and simply outputs-
, despite the fact that it can still be set and retrieved. Here's the source: https://gitlab.com/procps-ng/procps/-/blob/c415fc86452c933716053a50ab1777a343190dcc/src/ps/output.c#L703-711Minimal reproducer: