Introducing the Cacule Scheduler - a CFS replacement

Cacule-CPU-Scheduler

After testing several different schedulers, i have found one and it is fantastic.
It feels much more responsive then other scheduler’s ive tested (ive tested mostly every scheduler, bmq, muqss, pds, upds)

If compiling something and doing some other heavy work, no lags or something else.
Gaming feels much more responsive and less input lag,
Xanmod also implemented the cacule scheduler in his kernel, and the feedback is also great, i can only suggest everyone who wants a responsive desktop and also a great gaming experience to test the scheduler.

Take a watch at his GitHub for more detailed information’s.

I have also created a kernel builder with some other patches in, but not overloaded with patches.
You can enable winesync, futex and futex2, ive enabled them on default, just edit the PKGBUILD like youre whishes.
Also when you build the kernel, it will ask for GCC Optimizations, if youre unsure which architecture youre using, just take the NATIVE_INTEL or NATIVE_AMD.

https://aur.archlinux.org/packages/linux-cacule/

There is also an experimental Response Driven Balancer (RDB) | Load-Balancer
more informations you will find in the GitHub from the creator of it.

There is also a aur package for it:
https://aur.archlinux.org/packages/linux-cacule-rdb/

Feedback would be nice!

Best regards.

3 Likes

I have also tested linux-xanmod-cacule and I can confirm that among all the other CPU schedulers I have tested (bmq, pds, cfs, muqss) it is second place. First place is still muqss as it is in linux-lqx.

The question is how one wants to test responsiveness to come to a profound conclusion. I have my own way of doing it. I find the following test very meaningful.

I found that all CPU schedulers are doing pretty well when the CPU is under stress. If I put artificial stress on the CPU, like with stress-ng or mprime, I can see that all of them do a reasonably good job in starting applications and playing movies while under stress.

Interestingly, I found big differences in the schedulers when the memory is under stress while the CPU is not. I use memtester for that purpose. I start one memtester job per CPU core. While this is running I open an MKV movie with mpv and see how long it takes to start the playback and if it is stuttering or not.

During that exercise the CPU load stays pretty low and it is not heating up. But the difference between the CPU schedulers is significant. bmq for example does not even start the movie. CFS from stock arch kernel is stuttering. muqss is excellent with no stuttering. It plays the movie without issue. 2nd place is cacule.

Here is the script I use to start the memtester jobs in separate xfce4-terminal:

memtester-loop.sh
#!/usr/bin/zsh

mem=$1
iter=$2

if [[ $1 ]];
then
    mem=$1
else    
    mem=8192
fi
if [[ $2 ]];
then
    iter=$2
else
    iter=1
fi

for i in $(seq 1 $iter);
do
    echo "iter $i"
    xfce4-terminal -H --command "memtester $mem 1" &> /dev/null & 
done

I start 16 parallel jobs (Ryzen 7 3700x with 16 cores) to test 200 MB of RAM with each job:

memtester-loop.sh 200m 16

The 200 MB is sufficiently large to let memtester run for long enough to do all the movie testing.

When all terminals are up and running I have another terminal open where I start “mpv test.mkv”. test.mkv is a high quality full HD file.

Thats it. I find this test very meaningful and easy to do.

EDIT:
Correction about CPU load during this test. The CPU load is going up to 100 % but the CPU temperature stays moderately low.

3 Likes

I just tested the new linux-cacule kernel with memtester+mpv. The responsiveness is by far not as good as with linux-xanmod-cacule.

My recommendation here is: If you are really looking for good responsiveness you either pick linux-lqx or linux-xanmod-cacule.

Are there any movements to add muqss / cacule to default Kernel?

Thats why its so impressive, also the responsives for example in games (i was “pro” gamer in my earlier time and i feel big differnces between such things like inputlag, framedrops, and so on.

One of my biggest problem what cacule sloved for me, was the responsives in rocket league with the controller, really no scheduler got this responsives. mostly it felt like im playing on windows back.

if you mean linux-xanmod-cacule from the aur, i would stay away from these aur pkgbuilds, mine is not perfect since he “stole” linux-xanmod-cacule. If got with a mate a perfect PKGBUILD, for building xanmod, xanmod-cacule, xanmod-cacule-rdb, but mostly he “stole” the package some minutes earlier when i wanted to upload it. sad story, and also this guy is only copy pasting and got mostly no clue what he is doing.
But thats another thing.

I will implement the lqx patches soon, and some other config options, then its going better x)

Take a watch here:

There is every Scheduler with many patches in. For me its overbloated, but for everyone his thing

1 Like

Could you consider to add cacule scheduler to linux-zen kernel? linux-zen kernel on its own is already pretty good when it comes to performance/responsiveness. I would love to see how it will behave with cacule scheduler included.

1 Like

I’ll going to add the zenpatches to the PKGBUILD and also the lqx patches, if they went good together.
Mostly i dont want to have a pkgbuild with “hundered” patches, thats not the key,

Thanks for your input!

Im also going to implement some configuration options for the config file.

Also take a watch about the github repo of the founder.
There are also some great tips :slight_smile:

That wasn’t my question, but nice repo :upside_down_face:

What do you mean exactly ? Just adding muqss / cacule to the default kernel instead of CFS Default ?

I will compile a test kernel then we will see.
Much different options included which will be asked interactivly.
If the compile is succesfull then i need feedback again :slight_smile:

Its in the aur and updated.
The best is to git clone the repo and then do makepkg -si

https://aur.archlinux.org/packages/linux-cacule/
https://aur.archlinux.org/packages/linux-cacule-rdb/

what is the difference between the two? What does rdb stand for?

I dont know how good your knowledge is into schedulers, ill take what is in his github reporsity:

Response Driven Balancer (RDB)

This is an experimental load balancer for Cachy/CacULE. It is a lightweight load balancer which is a replacement of CFS load balancer. It migrates tasks based on their HRRN/Interactivity Scores (IS). Most of CFS load balancing-related updates (cfs and se updates loads) are removed. The RDB balancer follows CFS paradigm in which RDB balancing happen at the same points CFS does. RDB balancing happens in three functions: newidle_balance, idle_balance, and active_balance. The newidle_balance is called exactly at the same time as CFS did (when pick next task fails to find any task to run). The RDB newidle_balance pulls one task that is the highest HRRN/IS from any CPU. The RDB idle_balance is called in trigger_load_balance when CPU is idle, it does the same as newidle_balance but with slight changes since newidle_balance is a special case. The RDB active_balance checks if the current (NORMAL) runqueue has one task, if so, it pulls the highest of the highest HRRN/IS among all other CPUS. If the runqueue has more than one task, then it pulls any highest HRRN/IS (same as idle does). A CPU cannot pull a task from another CPU that has fewer tasks (when pull any). For the all three balancing newidle_balance, idle_balance, and active_balance, the cpu first tries to pull from a CPU that shares the same cache (cpus_share_cache). If can’t pull any then it tries to pull from any CPU even though they are not in the same core. Only when pulling the highest of the highest HRRN/IS (i.e. active_balance when CPU has one task), there is no check for shared cache.

Since trigger_load_balance is called for every tick, there is a guard time to prevent frequent tasks migration to reduce runqueues locking and to reduce unnecessary tasks migrations. The time is 3ms after each active_balance. This time guard is specifically for HZ=500,1000. We don’t want to run balancing every 2ms or 1ms to prevent regression in performance. Here is how frequent the trigger_load_balance would run balancer with given HZ values:

  • HZ=100 runs every ~10ms
  • HZ=250 runs every ~4ms
  • HZ=300 runs every ~3ms
  • HZ=500 runs every ~4ms
  • HZ=1000 runs every ~3ms

I tested linux-cacule 5.11.15-6. Installed it with paru. I left all options at default.

The responsiveness with my memtester+mpv test is not good. It is very slow at switching between windows and the movie is stuttering.

And concerning to me is this journal entry:

Spectre V2 : Spectre mitigation: kernel not compiled with retpoline; no mitigation available!

Did you got the questions ?
Which of them you have enabled ?

Do it like this:
git clone https://aur.archlinux.org/linux-cacule.git
cd linux-cacule and then makepkg -si

Also dont answer “Apply suggested config by Hamad Al Marri” with yes.
Dont apply this config, there will be security issues also yes.

I got all the questions and answered them all with “return” = default.

Mostly i wrote over everything a text what it effects.
What is your hardware?

Yep as new standard, i wonder if there are whispers about it :upside_down_face: