Does Linux 3.10 CFS have "timeslices"?

I am confused, because sched-design-CFS.txt clearly states:

CFS uses nanosecond granularity accounting and does not rely on any jiffies or other HZ detail. Thus the CFS scheduler has no notion of "timeslices" in the way the previous scheduler had, and has no heuristics whatsoever. There is only one central tunable (you have to switch on CONFIG_SCHED_DEBUG):


which can be used to tune the scheduler from "desktop" (i.e., low latencies) to "server" (i.e., good batching) workloads.

But then multiple task scheduler tuning guides suggest two different formulas of calculating a "timeslice". (Depending on the number of runnable tasks.) For example this OpenSUSE guide.

I am running only SCHED_FIFO threads on isolated CPUs.


CFS doesn't have timeslices "in the way the previous scheduler had".

In CFS a timeslice is basically the duration between consecutive switches to grant CPU execution time to the same thread. This gives you two options:

  • All of your threads have enough time to execute for at least min_granularity_ns within one latency_ns. Then, your timeslice = scheduling period * (task's weight/total weight of tasks in the run queue)

  • There are too many threads to fit in the latency_ns, so your timeslices get bigger to accommodate more threads that want to run according to timeslice = number_of_running_tasks * sched_min_granularity_ns

This is why CFS stands for a Completely Fair Scheduler, as is doesn't exclude threads with lower priorities but rather indiscriminately extends the timeslices for everyone.

  • aha, excellent! Thank you. So seems that I only had trouble understanding the "doesn't have timeslices in the way the previous scheduler had". :) Thanks a lot!! – Väinö Ertanen Jun 27 '18 at 13:16
  • mind accepting the answer, then? ;) @VäinöErtanen – emmrk Jun 27 '18 at 13:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.