]> git.itanic.dy.fi Git - rrdd/commit
worker_thread: Drop process priority when executing low priority work
authorTimo Kokkonen <timo.t.kokkonen@iki.fi>
Sat, 14 Jan 2017 15:32:40 +0000 (17:32 +0200)
committerTimo Kokkonen <timo.t.kokkonen@iki.fi>
Sat, 14 Jan 2017 15:32:40 +0000 (17:32 +0200)
commit98e1376b9b6dd62c1aadc54f51afc96881644e78
treeb9492baf6a44f6366953d8346fdea445460f4cd9
parentf1f186534e252c72aff958ea5db4f387b075d73e
worker_thread: Drop process priority when executing low priority work

When executing low priority work, it is a good idea to nice() the
process priority as well so that the executing of the work is truly
run as a low priority work. This decreases the interference the work
might have on the rest of the system.

To achieve this, the work executing loop is rewritten. Instead of
having a loop that always tries to execute the highest priority work,
separate the low priority and high priority handling in separate
loops. This simplifies the logic quite a bit. Furthermore, there is
really no need to convert a low priority worker back to executing high
priority work. When queuing work, a new worker thread is always
spawned whenever a high priority work is queued. Thus, there is no
really any chance a low priority worker could pick up any high
priority work once it has finished low priority work.

Now we no longer can do that as it is not possible to rise a thread
priority back up once it lowered its priority.

The executing logic of the worker thread is thus much simpler now.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
process.c