Giter Site home page Giter Site logo

Comments (6)

Vistaus avatar Vistaus commented on June 3, 2024 1

Sorry to hijack your topic, but can I ask a small question regarding the config? In the readme there's a section about HRRN and the command sysctl kernel.sched_hrrn_max_lifetime_ms=60000

Do I still need to run that command/add it to sysctl.conf or is that already applied by Cachy?

from cacule-cpu-scheduler.

hamadmarri avatar hamadmarri commented on June 3, 2024

Hi @Alt37

That makes some values questionable (like 300HZ (because with 1000/300 we can't get exact value); 1000HZ or even 500HZ because timer for preemption seem too low). Can we consider 250HZ as the recommended tick rate for Cachy?

The clock ticks will trigger some functions in the scheduler to check and update the current running task and check if it needs to be switched by another enqueued task. The very first version of Cachy was calling the resched_curr per tick, however, the next task could be the same as previous (depends on HRRN value). The recent versions on the other hand reduce the overhead of calling resched_curr every tick, it only calls resched_curr when the next higher HRRN task in runqueue is higher than current running task. Therefore, the current task runs until other task has a higher HRRN. Changing the clock HZ will have very tiny effect. Increasing HZ to lets say 1000hz, will make the scheduler able to detect that there is another task has a higher HRRN than current running task in 1ms precision. This might increase the interactivity feeling in desktops. A 500hz will do the same thing but within 2ms precision, 250hz/4ms and so forth. At the end of the day, it doesn't affect the general HRRN algorithm. Increasing HZ from 250 to 500 or 1000 will preempt current running task (if only there is another task that has higher HRRN) faster for 2ms or 3ms respectively.

I have to remove the HZ mentioning in readme because it is not specific to cachy, it is pretty much similar to CFS. The only difference with CFS is that the current running task will run until another task has lower virtual runtime. Where changing the HZ from 250 to 1000 just makes 1000's preempt check call per second instead of 250 calls.

In my opinion, I think the best value for a desktop is 500HZ. The 500HZ will cause the scheduler ticks every 2ms, which is a reasonable time to give the CPU 2ms to run the task without any interruptions.

100hz is good for battery savings, and mostly throughput. Cachy will 99% runs your mouse/keyboard clicks (due to higher HRRN values since such tasks were sleeping a lot of time) in 10ms - in case of 100hz. If a latency of ~10ms is acceptable, then Cachy might be not bad in latency and performant in 100hz.

1000hz is too high (unless if the difference in 1ms from 500ms has an effect in certain situations). It will
reduce throughput since sched ticks calls in CFS/Cachy are expensive compared to Muqss/PDS/BMQ.

Other values such as 250hz and 300hz are OK. I use cachy on 250hz because it matches my distro's default kernel settings for comparison reasons.

about CONFIG_PREEMPT

AFAIK, CONFIG_PREEMPT is to let the kernel thread preemptable. I believe the linux implementation of kernel preemtable is very good and is useful for interactivity since the kernel jobs can pause a bit to let the user space tasks to run. In theory, yes CONFIG_PREEMPT is recommended.

NO_HZ_FULL

If it is good in CFS then most likely it is also good in Cachy since Cachy uses CFS's code for most tasks' balancing jobs.

Thank you for rising these questions. Please let me know if you have any other questions.

from cacule-cpu-scheduler.

hamadmarri avatar hamadmarri commented on June 3, 2024

Sorry to hijack your topic, but can I ask a small question regarding the config? In the readme there's a section about HRRN and the command sysctl kernel.sched_hrrn_max_lifetime_ms=60000

Do I still need to run that command/add it to sysctl.conf or is that already applied by Cachy?

Hi @Vistaus
The default value is 30s. You have the ability to tune this value at run time. On some gaming test my friend did, he said that setting the hrrn_max_lifetime to 6000 (6s) gives more fps stability.

You don't have to run this command, but in some cases changing this value could increase performance.

Thanks

from cacule-cpu-scheduler.

Vistaus avatar Vistaus commented on June 3, 2024

Hi @hamadmarri Thanks for the explanation! :)

from cacule-cpu-scheduler.

raykzhao avatar raykzhao commented on June 3, 2024

Hi @hamadmarri

I'm wondering whether all the tunable parameters from CFS would still have the similar effect in cachy scheduler. For example, would the CFS tweaks from zen-kernel (zen-kernel/zen-kernel@0786252) still improve the responsiveness of the system?

Regards,
Raymond

from cacule-cpu-scheduler.

hamadmarri avatar hamadmarri commented on June 3, 2024

Hi @hamadmarri

I'm wondering whether all the tunable parameters from CFS would still have the similar effect in cachy scheduler. For example, would the CFS tweaks from zen-kernel (zen-kernel/zen-kernel@0786252) still improve the responsiveness of the system?

Regards,
Raymond

Hi @raykzhao

Most of the tuned values in zen kernel has an effect to cachy except:

sysctl_sched_wakeup_granularity
normalized_sysctl_sched_wakeup_granularity

Thanks for providing these tuned values, I thought that sysctl_sched_latency has no effect on cachy but apparently it does!

enqueue_task_fair > hrtick_update > hrtick_start_fair > sched_slice > __sched_period > sysctl_sched_latency

And in hrtick_start_fair we have resched_curr which depends on sched_slice. That was not intended to happen in Cachy.
I think we have a bug here :/ .
Edit: actually it doesn't effect.

Thanks

from cacule-cpu-scheduler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.