# Introducing the Cacule Scheduler - a CFS replacement

**URL:** <https://forum.endeavouros.com/t/introducing-the-cacule-scheduler-a-cfs-replacement/13644>\
**Category:** Kernel, boot, graphics & hardware\
**Created:** [April 17, 2021, 12:10am UTC](https://forum.endeavouros.com/t/introducing-the-cacule-scheduler-a-cfs-replacement/13644 "2021-04-17T00:10:08Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ptr1337](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/ptr1337/32/27185_2.png) [@ptr1337](https://forum.endeavouros.com/u/ptr1337)\
**Post date:** [April 17, 2021, 12:10am UTC](https://forum.endeavouros.com/t/introducing-the-cacule-scheduler-a-cfs-replacement/13644/1 "2021-04-17T00:10:08Z")

</div>

# 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.

> **[GitHub - hamadmarri/cacule-cpu-scheduler: The CacULE CPU scheduler is based on interactivity...](https://github.com/hamadmarri/cacule-cpu-scheduler)**
>
> The CacULE CPU scheduler is based on interactivity score mechanism. The interactivity score is inspired by the ULE scheduler (FreeBSD scheduler).

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/](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/](https://aur.archlinux.org/packages/linux-cacule-rdb/)

Feedback would be nice!

Best regards.

---

<div class="post-metadata">

**Author:** ![mbod](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/mbod/32/16833_2.png) [@mbod](https://forum.endeavouros.com/u/mbod)\
**Post date:** [April 17, 2021, 7:44am UTC](https://forum.endeavouros.com/t/introducing-the-cacule-scheduler-a-cfs-replacement/13644/2 "2021-04-17T07:44:18Z")

</div>

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**
>
> ```auto
> #!/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.

---

<div class="post-metadata">

**Author:** ![mbod](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/mbod/32/16833_2.png) [@mbod](https://forum.endeavouros.com/u/mbod)\
**Post date:** [April 17, 2021, 8:41am UTC](https://forum.endeavouros.com/t/introducing-the-cacule-scheduler-a-cfs-replacement/13644/3 "2021-04-17T08:41:55Z")

</div>

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`.

---

<div class="post-metadata">

**Author:** ![keybreak](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/keybreak/32/9257_2.png) [@keybreak](https://forum.endeavouros.com/u/keybreak)\
**Post date:** [April 17, 2021, 8:44am UTC](https://forum.endeavouros.com/t/introducing-the-cacule-scheduler-a-cfs-replacement/13644/4 "2021-04-17T08:44:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ptr1337](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/ptr1337/32/27185_2.png) [@ptr1337](https://forum.endeavouros.com/u/ptr1337)\
**Post date:** [April 17, 2021, 8:48am UTC](https://forum.endeavouros.com/t/introducing-the-cacule-scheduler-a-cfs-replacement/13644/5 "2021-04-17T08:48:48Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![ptr1337](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/ptr1337/32/27185_2.png) [@ptr1337](https://forum.endeavouros.com/u/ptr1337)\
**Post date:** [April 17, 2021, 8:52am UTC](https://forum.endeavouros.com/t/introducing-the-cacule-scheduler-a-cfs-replacement/13644/6 "2021-04-17T08:52:03Z")

</div>

Take a watch here:

> **[GitHub - ptr1337/archlinux-kernel-builder: Linux kernel build for Archlinux...](https://github.com/ptr1337/archlinux-kernel-builder)**
>
> Linux kernel build for Archlinux with a patch set by TK-Glitch, Piotr Górski, Hamad Al Marri, Con Kolivas and Alfred Chen. - GitHub - ptr1337/archlinux-kernel-builder: Linux kernel build for Archli...

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

---

<div class="post-metadata">

**Author:** ![mbod](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/mbod/32/16833_2.png) [@mbod](https://forum.endeavouros.com/u/mbod)\
**Post date:** [April 17, 2021, 8:52am UTC](https://forum.endeavouros.com/t/introducing-the-cacule-scheduler-a-cfs-replacement/13644/7 "2021-04-17T08:52:15Z")

</div>

> [@ptr1337](#):
>
> I will implement the lqx patches soon, and some other config options, then its going better x)

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.

---

<div class="post-metadata">

**Author:** ![ptr1337](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/ptr1337/32/27185_2.png) [@ptr1337](https://forum.endeavouros.com/u/ptr1337)\
**Post date:** [April 17, 2021, 8:55am UTC](https://forum.endeavouros.com/t/introducing-the-cacule-scheduler-a-cfs-replacement/13644/8 "2021-04-17T08:55:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ptr1337](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/ptr1337/32/27185_2.png) [@ptr1337](https://forum.endeavouros.com/u/ptr1337)\
**Post date:** [April 17, 2021, 9:04am UTC](https://forum.endeavouros.com/t/introducing-the-cacule-scheduler-a-cfs-replacement/13644/9 "2021-04-17T09:04:11Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![keybreak](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/keybreak/32/9257_2.png) [@keybreak](https://forum.endeavouros.com/u/keybreak)\
**Post date:** [April 17, 2021, 9:12am UTC](https://forum.endeavouros.com/t/introducing-the-cacule-scheduler-a-cfs-replacement/13644/10 "2021-04-17T09:12:39Z")

</div>

That wasn’t my question, but nice repo 🙃

---

<div class="post-metadata">

**Author:** ![ptr1337](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/ptr1337/32/27185_2.png) [@ptr1337](https://forum.endeavouros.com/u/ptr1337)\
**Post date:** [April 17, 2021, 10:11am UTC](https://forum.endeavouros.com/t/introducing-the-cacule-scheduler-a-cfs-replacement/13644/11 "2021-04-17T10:11:44Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![ptr1337](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/ptr1337/32/27185_2.png) [@ptr1337](https://forum.endeavouros.com/u/ptr1337)\
**Post date:** [April 17, 2021, 10:27am UTC](https://forum.endeavouros.com/t/introducing-the-cacule-scheduler-a-cfs-replacement/13644/12 "2021-04-17T10:27:02Z")

</div>

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/)  
[https://aur.archlinux.org/packages/linux-cacule-rdb/](https://aur.archlinux.org/packages/linux-cacule-rdb/)

---

<div class="post-metadata">

**Author:** ![mbod](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/mbod/32/16833_2.png) [@mbod](https://forum.endeavouros.com/u/mbod)\
**Post date:** [April 17, 2021, 10:36am UTC](https://forum.endeavouros.com/t/introducing-the-cacule-scheduler-a-cfs-replacement/13644/13 "2021-04-17T10:36:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ptr1337](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/ptr1337/32/27185_2.png) [@ptr1337](https://forum.endeavouros.com/u/ptr1337)\
**Post date:** [April 17, 2021, 10:39am UTC](https://forum.endeavouros.com/t/introducing-the-cacule-scheduler-a-cfs-replacement/13644/14 "2021-04-17T10:39:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mbod](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/mbod/32/16833_2.png) [@mbod](https://forum.endeavouros.com/u/mbod)\
**Post date:** [April 17, 2021, 11:04am UTC](https://forum.endeavouros.com/t/introducing-the-cacule-scheduler-a-cfs-replacement/13644/15 "2021-04-17T11:04:24Z")

</div>

> [@ptr1337](#):
>
> If the compile is succesfull then i need feedback again 🙂

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!`

---

<div class="post-metadata">

**Author:** ![ptr1337](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/ptr1337/32/27185_2.png) [@ptr1337](https://forum.endeavouros.com/u/ptr1337)\
**Post date:** [April 17, 2021, 11:33am UTC](https://forum.endeavouros.com/t/introducing-the-cacule-scheduler-a-cfs-replacement/13644/16 "2021-04-17T11:33:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ptr1337](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/ptr1337/32/27185_2.png) [@ptr1337](https://forum.endeavouros.com/u/ptr1337)\
**Post date:** [April 17, 2021, 11:38am UTC](https://forum.endeavouros.com/t/introducing-the-cacule-scheduler-a-cfs-replacement/13644/17 "2021-04-17T11:38:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mbod](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/mbod/32/16833_2.png) [@mbod](https://forum.endeavouros.com/u/mbod)\
**Post date:** [April 17, 2021, 11:41am UTC](https://forum.endeavouros.com/t/introducing-the-cacule-scheduler-a-cfs-replacement/13644/18 "2021-04-17T11:41:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ptr1337](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/ptr1337/32/27185_2.png) [@ptr1337](https://forum.endeavouros.com/u/ptr1337)\
**Post date:** [April 17, 2021, 11:46am UTC](https://forum.endeavouros.com/t/introducing-the-cacule-scheduler-a-cfs-replacement/13644/19 "2021-04-17T11:46:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![keybreak](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/keybreak/32/9257_2.png) [@keybreak](https://forum.endeavouros.com/u/keybreak)\
**Post date:** [April 17, 2021, 12:05pm UTC](https://forum.endeavouros.com/t/introducing-the-cacule-scheduler-a-cfs-replacement/13644/20 "2021-04-17T12:05:02Z")

</div>

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

[Next page](https://forum.endeavouros.com/t/introducing-the-cacule-scheduler-a-cfs-replacement/13644.md?page=2)
