Merge lp:~vorlon/upstart/default-priority-not-always-zero into lp:upstart
Proposed by
Steve Langasek
Status: | Merged |
---|---|
Merged at revision: | 1412 |
Proposed branch: | lp:~vorlon/upstart/default-priority-not-always-zero |
Merge into: | lp:upstart |
Diff against target: |
93 lines (+20/-6) 5 files modified
ChangeLog (+9/-0) init/job_class.c (+3/-1) init/job_class.h (+3/-3) init/job_process.c (+2/-1) init/tests/test_job_class.c (+3/-1) |
To merge this branch: | bzr merge lp:~vorlon/upstart/default-priority-not-always-zero |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
James Hunt | Approve | ||
Review via email: mp+140025@code.launchpad.net |
This proposal supersedes a proposal from 2012-11-18.
Description of the change
Upstart doesn't cope well when it can't set the nice level to 0, which may
be the case if the process is non-root and has been niced. So instead of
using 0 as the default, use the current nice level as the default; this
gives identical results in the common case, and there's really no reason a
non-root upstart should fail if niced.
To post a comment you must log in.
Hi Steve,
I think really we should be querying the priority when jobs are started since otherwise we effectively cache the priority such that if it is changed _after_ a Session Init is started, any newly-created user job will be run with the original priority.
I think the correct fix therefore is to modify job_process_spawn() to call getpriority() just prior to the setpriority() to deterine the current priority. We can retain the original behaviour if running as root *and* as PID 1, but not if only running as root (to allow for root running a Session Init).