Change Power Scaling Governor - Permanently -

If none of the more specific forums is the right place to ask

Change Power Scaling Governor - Permanently -

Postby Jean Charalab » 2020-09-19 10:31

Good evening gentlemen. IM trying to change the default governor from ondemand into powersave in my laptop, so far i ve found many ways to do it but every single one of them had been reset when i reboot the system. So do you know any ways to make this permanently? Thanks for your time.
Jean Charalab
 
Posts: 12
Joined: 2020-08-31 14:55

Re: Change Power Scaling Governor - Permanently -

Postby Deb-fan » 2020-09-19 12:52

viewtopic.php?f=16&t=147319#p727259

I use method #3 some of the lines in the script that's run at system start sets my preferred power governor on cpu-cores.

Ps, more thoughts, are also pkgs/utils to set-change governor and core frequencies, get info on cpus state etc ... like cpupower. Lastly someone can also add a udev rule to run a script and change this based on whether the system is plugged(on AC) or for when it's running on battery.
Most powerful FREE tech-support tool on the planet * HERE. *
Deb-fan
 
Posts: 956
Joined: 2012-08-14 12:27

Re: Change Power Scaling Governor - Permanently -

Postby Jean Charalab » 2020-09-19 14:03

Thanks for the reply brother
Jean Charalab
 
Posts: 12
Joined: 2020-08-31 14:55

Re: Change Power Scaling Governor - Permanently -

Postby Head_on_a_Stick » 2020-09-19 14:12

Note that there is no need to prepend the ExecStart statement in a systemd unit file with /bin/bash if the script being called has a #!/bin/bash shebang at the top.

Also note that if the scripts do not use any bashisms[0] then they will run quicker, use less memory and expose fewer potential bugs if a #!/bin/sh shebang is used instead (/bin/sh is symlinked to dash in Debian and all system scripts in Debian use dash instead of bash for the reasons I just listed).

[0] Use checkbashisms(1) (supplied by the devscripts package) to check for any bashisms.

EDIT: systemd-tmpfiles or a kernel module option can also be used to change the governor: https://wiki.archlinux.org/index.php/CP ... _permanent
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 12650
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Change Power Scaling Governor - Permanently -

Postby Deb-fan » 2020-09-19 14:31

^^ Welcome. :D

Used cpufrequtils to do this for awhile. It's just a util similar to but cpupower is newer, thus should be better n more feature rich. Have never used it though. Can say either util would surely work well regardless. Did that before learning what i think is the right way, aka: a script to echo adjustments to the relevant system files and set this kind of thing.

Lol ... this is gnu/linux, if you can dream up or want to do just about anything with a computer some geek(s) probably already came out with cool tools and ways to do it. Only for the record the ondemand governor can be tuned to do a lot, such as set a certain min or max cpu frequency, so say someone wanted to set a more controlled freq-range for system cores or wanted to peg them at lowest to conserve power or etc, easily enough done too. Anyway happy computing folks.

Ps, @Head_on, thanks for the clarifications too. :)
Most powerful FREE tech-support tool on the planet * HERE. *
Deb-fan
 
Posts: 956
Joined: 2012-08-14 12:27

Re: Change Power Scaling Governor - Permanently -

Postby Jean Charalab » 2020-09-19 14:35

[quote="Head_on_a_Stick"] the kernel option sounds good and easier but how to apply it?
Jean Charalab
 
Posts: 12
Joined: 2020-08-31 14:55

Re: Change Power Scaling Governor - Permanently -

Postby Head_on_a_Stick » 2020-09-19 15:26

The module option can only be used to disable intel_pstate: https://unix.stackexchange.com/question ... nservative

Try this script:
Code: Select all
#!/bin/sh
for i in /sys/devices/system/cpu/cpufreq/policy*; do
   echo powersave > "$i"/scaling_governor
done

Either add it to /etc/rc.local (without the shebang, that file already includes one) or call it from a systemd unit file or udev rule.

But check if that governor is actually available:
Code: Select all
cat /sys/devices/system/cpu/cpufreq/policy*/scaling_available_governors
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 12650
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Change Power Scaling Governor - Permanently -

Postby Deb-fan » 2020-09-19 16:04

Dammit gotta do it, mentioned being Nix and tech it's pretty much endless or can be depending on how much a nixer wants to learn. Random comments on this, when it comes to changing power governor on a mobile device in an effort to conserve battery, really think someone would get MUCHO further just using a udev or etc rule to reduce the systems backlight, turn it down to a more reasonable level when on battery. As based on various research into whether it makes all that much difference to throttle something like cpu freqs, performance governor(keep freqs at max @all times) vs ondemand, adjust based on load, the amount of juice involved in my view must be trivial. Can't make all that big a difference and clearly there are greater considerations ... such as screen brightness or etc which are much more pertinent to adjust for good results.

Also are tools which can do this type of thing, change power profiles and adjust system settings based on whether AC or on battery. One of which being TLP, never messed with it ... outside of reading about the thing. Also as already noted udev rules and the thingies Head_on mentioned can be used for such purposes too. Google knows all things. :)

As for the original thing, obviously I have a preference for ondemand on systems where it's relevant and so learned about using and tuning it. For me that's probably ALL pc's. When it comes to things like what freq cores are set or allowed at, my opinion on it is that it should be the right one depending on the systems workload. I don't want my cpu's running at max clock all the time, mostly just due to not wanting the extra heat + wear and tear on my pc's chip. Though when the system is doing something and under load, yeah, freqs should jump up as/when needed. Higher freqs has to mean more tasks getting done in less time on the system, thus smoother and better performance but when it's sitting idle, want the cores running nice and cool. Also in my ancient systems case, makes no sense to me to have a dual-core capable of @2.17ghz and have a governor which never allows it to be used.

Also though the defaults used with ondemand imo are crappy and someone should learn how to adjust them to suit their needs and get better overall system performance. There's plenty more commentary on this but enough's .. enough. :P
Most powerful FREE tech-support tool on the planet * HERE. *
Deb-fan
 
Posts: 956
Joined: 2012-08-14 12:27

Re: Change Power Scaling Governor - Permanently -

Postby Jean Charalab » 2020-09-19 16:43

Thanks Head
Jean Charalab
 
Posts: 12
Joined: 2020-08-31 14:55

Re: Change Power Scaling Governor - Permanently -

Postby stevepusser » 2020-09-19 17:18

Lazy guys' method, like me, is to use indicator-cpufreq, especially if one would switch back and forth to kernels that default to the performance setting, like Liquorix. Note that recently, Liquorix does not boot to using pstate automatically, but I prefer that it does, so have added the "intel_pstate=enable" (yes, I know this only applies to recent Intel CPUs) to my boot options. Otherwise, I rarely fully reboot other than testing new kernels, since I have suspend2ram, s2disk, and even hybrid sleep working on my two laptops, so resetting the options is not much of a chore.

Once running, indicator-cpufreq starts with every new xfce or KDE session of mine.

http://mxrepo.com/mx/repo/pool/main/i/i ... r-cpufreq/
MX Linux packager and developer
User avatar
stevepusser
 
Posts: 12083
Joined: 2009-10-06 05:53

Re: Change Power Scaling Governor - Permanently -

Postby Deb-fan » 2020-09-19 17:28

^^ Person of few words, eh? Lol though technically a few is 3, so person of two words huh. :P For sake of completeness (read being anal) in terms of core temps are utils and/or methods to adjust things like at what temp-range cooling fans operate. Those fans use juice too.

Whether this should be fiddled with can depend of course, though if applicable n advisable changing such can logically result in a quieter, more juice conservative system at the cost of it being setup to run hotter and whatever temp range chosen should obviously be kept reasonable. Frying an egg on your PC doesn't make sense with stoves + skillets around. :)

Edit: want to put this here, as looks like a decent resource on the gist of my post. https://askubuntu.com/questions/22108/h ... peed#46135
Last edited by Deb-fan on 2020-09-19 21:40, edited 1 time in total.
Most powerful FREE tech-support tool on the planet * HERE. *
Deb-fan
 
Posts: 956
Joined: 2012-08-14 12:27

Re: Change Power Scaling Governor - Permanently -

Postby Jean Charalab » 2020-09-19 18:12

Head and rest of fellows, what about just using this? https://wiki.debian.org/CpuFrequencyScaling
Before i install it i had only ondemand schedutil and performance, now i ve also userspace conservative and powersave as available governors
I simple add GOVERNOR="powersave" into /etc/default/cpufrequtils
Is this wrong? I saw cpufrequtils are suggesting by laptop task also
Jean Charalab
 
Posts: 12
Joined: 2020-08-31 14:55

Re: Change Power Scaling Governor - Permanently -

Postby Deb-fan » 2020-09-19 18:42

See https://forums.bunsenlabs.org/viewtopic.php?id=4453

While things have changed for me since then, noted ive moved away from using cpufrequtils etc but yeppers info for setting it up such as choosing power governor should be covered in that old tute. :)

Ps, sounds about right, though can't remember if i had the file you mention at that location or needed to create it myself, try it and check though. Think the docs do-did say its the right file and location for it.
Most powerful FREE tech-support tool on the planet * HERE. *
Deb-fan
 
Posts: 956
Joined: 2012-08-14 12:27

Re: Change Power Scaling Governor - Permanently -

Postby stevepusser » 2020-09-19 19:22

Speaking of tlp, we do ship it with MX, and it seems its default settings improve power consumption. We also have a python-based GUI for changing its settings in the test repo, as well as a backport of tlp 1.3.1, but buster-backports has since also added the latest tlp.

Anyhow, the settings are still kind of mystifying in tlpui, even with the popup tips, but I've eventually managed to get them where I wanted for AC and battery, along with indicator-cpufreq. You still have to run "sudo tlp start" manually for your changes to take effect without rebooting, which should be built into tlpui, IMO.

I've mentioned it before, but since the tools aren't in Debian proper, another major thing I do it is undervolt my Intel CPU and GPUs to have them run cooler, faster, and use less power overall, even on AC. You can monitor the voltages in real time with i7z in the terminal, which is in the repo. AFAIK, easy undervolting is only available with Intel core third generation and newer--older processors require a specially compiled kernel. Before someone spreads FUD about how dangerous undervolting could be, I need to point out that it's very common on the Windows side of things, where the freeware program Throttlestop does the same thing and is very popular among performance enthusiasts---which are gamers for the most part.
MX Linux packager and developer
User avatar
stevepusser
 
Posts: 12083
Joined: 2009-10-06 05:53

Re: Change Power Scaling Governor - Permanently -

Postby Deb-fan » 2020-09-19 20:15

Pretty cool, think that was the reason never pursued tlp seemed too complicated at the time. First year or so thought the Archwiki was written in klingon though. Got any klingon translator software pkg'ed in the Mx repo's? :P
Most powerful FREE tech-support tool on the planet * HERE. *
Deb-fan
 
Posts: 956
Joined: 2012-08-14 12:27

Next

Return to General Questions

Who is online

Users browsing this forum: No registered users and 13 guests

fashionable