How to change linux default scheduling method

iveqy asked:

I’ve a jenkins server and running a lot of CPU bound compilations. I want to change the scheduler from SCHED_NORMAL to SCHED_BATCH. I know it can be done with chrt but I want the system to use it by default for all jenkins jobs (and perhaps all processes on the system).

How can I set SCHED_BATCH to be the default?

My answer:

You can modify the systemd unit which starts Jenkins to set the CPU scheduling policy, using CPUSchedulingPolicy=.

Sets the CPU scheduling policy for executed processes. Takes one of other, batch, idle, fifo or rr. See sched_setscheduler(2) for details.

So you might create a drop-in for your Jenkins systemd service with a path such as /etc/systemd/system/jenkins.service.d/scheduler.conf:


View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.