Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #273984 > unrolled thread

lower CPU speed

Started byEben King <eben@gmx.us>
First post2024-10-23 20:50 +0200
Last post2024-10-23 23:20 +0200
Articles 11 — 7 participants

Back to article view | Back to linux.debian.user


Contents

  lower CPU speed Eben King <eben@gmx.us> - 2024-10-23 20:50 +0200
    Re: lower CPU speed Michael Kjörling <c9bc136c6063@ewoof.net> - 2024-10-23 21:10 +0200
      Re: lower CPU speed Lee <ler762@gmail.com> - 2024-10-23 23:50 +0200
        Re: lower CPU speed Hans <hans.ullrich@loop.de> - 2024-10-24 17:10 +0200
    Re: lower CPU speed Mike <debian@good-with-numbers.com> - 2024-10-23 22:30 +0200
    Re: lower CPU speed eben@gmx.us - 2024-10-23 22:30 +0200
    Re: lower CPU speed Greg Wooledge <greg@wooledge.org> - 2024-10-23 22:50 +0200
      Re: lower CPU speed Hans <hans.ullrich@loop.de> - 2024-10-23 23:10 +0200
        Re: lower CPU speed eben@gmx.us - 2024-10-23 23:30 +0200
    Re: lower CPU speed Hans <hans.ullrich@loop.de> - 2024-10-23 22:50 +0200
      Re: lower CPU speed eben@gmx.us - 2024-10-23 23:20 +0200

#273984 — lower CPU speed

FromEben King <eben@gmx.us>
Date2024-10-23 20:50 +0200
Subjectlower CPU speed
Message-ID<JAOAF-3JMx-1@gated-at.bofh.it>
I have a variable-speed CPU.  Normally the OS manages it.  If I want to make
less heat inside the case, is it possible to cap it at a certain speed?

--
Did they get you to trade your heroes for ghosts?  Hot ashes for trees?
Hot air for a cool breeze?  Cold comfort for change?
Did you exchange a walk-on part in the war for a lead role in a cage?
     -- Pink Floyd, "Wish You Were Here" from _Wish You Were Here_ (1975)

[toc] | [next] | [standalone]


#273985

FromMichael Kjörling <c9bc136c6063@ewoof.net>
Date2024-10-23 21:10 +0200
Message-ID<JAOU1-3K8s-11@gated-at.bofh.it>
In reply to#273984
On 23 Oct 2024 14:46 -0400, from eben@gmx.us (Eben King):
> I have a variable-speed CPU.  Normally the OS manages it.  If I want to make
> less heat inside the case, is it possible to cap it at a certain speed?

CPU speed is controlled by the CPU frequency governor.

Set /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor to
"ondemand" or "conservative" (the main difference is how quickly they
react to load changes), and /sys/devices/system/cpu/cpu*/cpufreq/scaling_max_freq
as desired. (Value in the latter is in Hz.) The
"scaling_available_governors" and "scaling_available_frequencies"
pseudo-files in the same directory are likely to be instructive.

You can also set the governor to "powersave" to run the CPU at its
minimum supported speed.

The changes will be lost on reboot so you'll need something to reapply
them during or after a reboot if that's what you want.

I think the linux-cpupower Debian package provides a nicer CLI
front-end.

-- 
Michael Kjörling
🔗 https://michael.kjorling.se

[toc] | [prev] | [next] | [standalone]


#273993

FromLee <ler762@gmail.com>
Date2024-10-23 23:50 +0200
Message-ID<JARoR-3Lvj-1@gated-at.bofh.it>
In reply to#273985
On Wed, Oct 23, 2024 at 3:04 PM Michael Kjörling wrote:
>
> On 23 Oct 2024 14:46 -0400, from eben@gmx.us (Eben King):
> > I have a variable-speed CPU.  Normally the OS manages it.  If I want to make
> > less heat inside the case, is it possible to cap it at a certain speed?
>
> CPU speed is controlled by the CPU frequency governor.
>
> Set /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor to
> "ondemand" or "conservative"

What kind of cpu does your system have?
Mine is an Intel and .. at least as far as I can tell, has only the
"performance" or  "powersave" options:

$ sudo cpupower -c all frequency-info | grep 'governor'
  available cpufreq governors: performance powersave
                  The governor "powersave" may decide which speed to use
  available cpufreq governors: performance powersave
                  The governor "powersave" may decide which speed to use
  available cpufreq governors: performance powersave
                  The governor "powersave" may decide which speed to use
  available cpufreq governors: performance powersave
                  The governor "powersave" may decide which speed to use
  available cpufreq governors: performance powersave
                  The governor "powersave" may decide which speed to use
  available cpufreq governors: performance powersave
                  The governor "powersave" may decide which speed to use

> (the main difference is how quickly they
> react to load changes), and /sys/devices/system/cpu/cpu*/cpufreq/scaling_max_freq
> as desired. (Value in the latter is in Hz.) The
> "scaling_available_governors" and "scaling_available_frequencies"
> pseudo-files in the same directory are likely to be instructive.
>
> You can also set the governor to "powersave" to run the CPU at its
> minimum supported speed.

I think I've got the "powersave" govenor selected and the CPU
frequency does not stay at the minimum level:

$ cpufreq-info | grep "current CPU "
  current CPU frequency is 800 MHz.
  current CPU frequency is 800 MHz.
  current CPU frequency is 800 MHz.
  current CPU frequency is 800 MHz.
  current CPU frequency is 800 MHz.
  current CPU frequency is 800 MHz.

then in another window

$ while true; do : ; done

and all the cpus max out

$ cpufreq-info | grep "current CPU "
  current CPU frequency is 4.10 GHz.
  current CPU frequency is 4.00 GHz.
  current CPU frequency is 4.00 GHz.
  current CPU frequency is 4.00 GHz.
  current CPU frequency is 4.00 GHz.
  current CPU frequency is 4.00 GHz.


Regards,
Lee

[toc] | [prev] | [next] | [standalone]


#273998

FromHans <hans.ullrich@loop.de>
Date2024-10-24 17:10 +0200
Message-ID<JB7Dj-3VB6-1@gated-at.bofh.it>
In reply to#273993

[Multipart message — attachments visible in raw view] — view raw

Dunno if this helps.

My cpu is an Intel I7-2670QM.

The related files, you might need to check are:

--------------------

/etc/laptop-mode/conf.d/cpufreq.conf 

As far as I remember I chaned nothing here in the past.

--------------------

Second one is:
 /etc/modules

in here I set the following entries:

powernow-k8
cpufreq_powersave
cpufreq_ondemand
cpufreq_userspace

--------------------

Third one, which might be related:
/etc/modules-load.d/modules.conf

In here are alsoi the three entries as above:

powernow-k8
cpufreq_powersave
cpufreq_ondemand
cpufreq_userspace

--------------------

I think, the powernow-k8 entry is no more needed, and is a relic from old times.

Additionally check 

/etc/laptop-mode/laptop-mode.conf

Although you might run a desktop computer, the package laptop-mode might be helpfull.


--------------------
Hope this helps.

Best 

Hans


> I think I've got the "powersave" govenor selected and the CPU
> frequency does not stay at the minimum level:
> 
> $ cpufreq-info | grep "current CPU "
>   current CPU frequency is 800 MHz.
>   current CPU frequency is 800 MHz.
>   current CPU frequency is 800 MHz.
>   current CPU frequency is 800 MHz.
>   current CPU frequency is 800 MHz.
>   current CPU frequency is 800 MHz.
> 
> then in another window
> 
> $ while true; do : ; done
> 
> and all the cpus max out
> 
> $ cpufreq-info | grep "current CPU "
>   current CPU frequency is 4.10 GHz.
>   current CPU frequency is 4.00 GHz.
>   current CPU frequency is 4.00 GHz.
>   current CPU frequency is 4.00 GHz.
>   current CPU frequency is 4.00 GHz.
>   current CPU frequency is 4.00 GHz.
> 
> 
> Regards,
> Lee


[toc] | [prev] | [next] | [standalone]


#273986

FromMike <debian@good-with-numbers.com>
Date2024-10-23 22:30 +0200
Message-ID<JAQ9s-3KPo-1@gated-at.bofh.it>
In reply to#273984
Eben King wrote:
> I have a variable-speed CPU.  Normally the OS manages it.  If I want to make
> less heat inside the case, is it possible to cap it at a certain speed?

If you're trying to control the heat--i.e., the power dissipation--your BIOS
may have a CPU setting for the PL1, Power Limit 1, or such.  That would be
more direct.

[toc] | [prev] | [next] | [standalone]


#273987

Fromeben@gmx.us
Date2024-10-23 22:30 +0200
Message-ID<JAQ9s-3KPo-3@gated-at.bofh.it>
In reply to#273984
On 10/23/24 14:52, Brad Rogers wrote:
> On Wed, 23 Oct 2024 14:46:05 -0400
> Eben King <eben@gmx.us> wrote:
>
> Hello Eben,
>
>> less heat inside the case, is it possible to cap it at a certain speed?
>
> Yes.  I use cpupower-gui for that sort of thing.

Is that in the package "linux-cpupower", or where do you get it?

--
               Remember, if you're not part of the solution,
                    you're part of the precipitate.

[toc] | [prev] | [next] | [standalone]


#273988

FromGreg Wooledge <greg@wooledge.org>
Date2024-10-23 22:50 +0200
Message-ID<JAQsO-3KVR-5@gated-at.bofh.it>
In reply to#273984
On Wed, Oct 23, 2024 at 22:46:09 +0200, Hans wrote:
> #:/bin/bash
> 
> cpufreq-set -c 0 -u 800MHz
> cpufreq-set -c 1 -u 800MHz
> cpufreq-set -c 2 -u 800MHz
> cpufreq-set -c 3 -u 800MHz

For the record, that should be #!/bin/bash instead of #:/bin/bash
(or you could use #!/bin/sh in this case, since you're not actually
using any bash extensions).

[toc] | [prev] | [next] | [standalone]


#273990

FromHans <hans.ullrich@loop.de>
Date2024-10-23 23:10 +0200
Message-ID<JAQM9-3LhJ-7@gated-at.bofh.it>
In reply to#273988

[Multipart message — attachments visible in raw view] — view raw

Am Mittwoch, 23. Oktober 2024, 22:47:54 CEST schrieb Greg Wooledge:
> On Wed, Oct 23, 2024 at 22:46:09 +0200, Hans wrote:
> > #:/bin/bash
> > 
> > cpufreq-set -c 0 -u 800MHz
> > cpufreq-set -c 1 -u 800MHz
> > cpufreq-set -c 2 -u 800MHz
> > cpufreq-set -c 3 -u 800MHz
> 
> For the record, that should be #!/bin/bash instead of #:/bin/bash
> (or you could use #!/bin/sh in this case, since you're not actually
> using any bash extensions).

Yes, of course, just a little typo.

Tried a second ago, if it still works. 

cpufreq-info | grep "current CPU" 
 current CPU frequency is 797 MHz. 
 current CPU frequency is 797 MHz. 
 current CPU frequency is 797 MHz. 
 current CPU frequency is 798 MHz. 
 current CPU frequency is 800 MHz. 
 current CPU frequency is 800 MHz. 
 current CPU frequency is 797 MHz. 
 current CPU frequency is 800 MHz.

Then ran "glxgears", which normally let the cpu raise to full clock speed, but got the same 
result: all cores are 800 MHz.

I am suing this, when my computer is working and will not need much cpu-power, for example, 
when building a livefile system. Most work then is writing to the harddrive, which does not need 
much cpu power. And no process can suddenly raise my cpu power! 

Such I can do unattended tasks safely. I believe, this is what the op wants to do.

Hans

[toc] | [prev] | [next] | [standalone]


#273992

Fromeben@gmx.us
Date2024-10-23 23:30 +0200
Message-ID<JAR5v-3LoQ-3@gated-at.bofh.it>
In reply to#273990
On 10/23/24 17:02, Hans wrote:

> Such I can do unattended tasks safely. I believe, this is what the op wants to do.

The video card I have (GTX 970) doesn't enable its fan by default, plus
gives bizarre ever-changing values for fan speed when you ask it.  I found a
workaround, by disabling and re-enabling each monitor in turn using DPMS.
But once you've done the workaround the GPU still won't behave _until_ it
drops to 60C.  Which is easy enough if the computer's cold from being off
all night, but if you just restarted it's already hot in there.  So that's
what I'm going to try, running the CPU slow so it (hopefully) cools down enough.

--
Most rock journalism is people who can't write interviewing people who
can't talk for people who can't read.
		-- Frank Zappa (from MM, Jr)

[toc] | [prev] | [next] | [standalone]


#273989

FromHans <hans.ullrich@loop.de>
Date2024-10-23 22:50 +0200
Message-ID<JAQsO-3KVR-7@gated-at.bofh.it>
In reply to#273984

[Multipart message — attachments visible in raw view] — view raw

Am Mittwoch, 23. Oktober 2024, 20:46:05 CEST schrieb Eben King:
> I have a variable-speed CPU.  Normally the OS manages it.  If I want to make
> less heat inside the case, is it possible to cap it at a certain speed?

Try the command "cpufreq-set" like the example:

cpufreq-set -c 0 -u 800MHz

or any frequency your cpu can use.

I added this command to a little shell script named "cpufreq-min.sh" and copied it to /usr/bin/

So the cpu is forced to stay low on frequency. There is another script, called "cpufreq-max.sh" 
which does set the opposite, I guess you know the trick.

Note: You must set each cpu seperately, so if you got i.e. 4 cores, your sript will need 4 lines for 
each core, like: 

---

#:/bin/bash

cpufreq-set -c 0 -u 800MHz
cpufreq-set -c 1 -u 800MHz
cpufreq-set -c 2 -u 800MHz
cpufreq-set -c 3 -u 800MHz

---

This got the advantage, you can control each core seperately.

Hope this helps.

Best

Hans

[toc] | [prev] | [next] | [standalone]


#273991

Fromeben@gmx.us
Date2024-10-23 23:20 +0200
Message-ID<JAQVP-3LlK-11@gated-at.bofh.it>
In reply to#273989
On 10/23/24 16:46, Hans wrote:
 > Am Mittwoch, 23. Oktober 2024, 20:46:05 CEST schrieb Eben King:
 >> I have a variable-speed CPU.  Normally the OS manages it.  If I want to make
 >> less heat inside the case, is it possible to cap it at a certain speed?
 >
 > Try the command "cpufreq-set"

Thanks, it's installed.  Hopefully it's enough the next time I need it.  BTW
it was in the package  "cpufrequtils".

I got a warning "W: Download is performed unsandboxed as root as file
'/root/.synaptic/tmp//tmp_sh' couldn't be accessed by user '_apt'. -
pkgAcquire::Run (13: Permission denied)"

And while that file is readable by non-root users, none of the directories
leading up to it are.  I don't think that should be a problem if you know
what you're looking for:

eben@cerberus:~$ sudo ls -ld /root/.synaptic/tmp/tmp_sh /root/.synaptic/tmp
/root/.synaptic /root
drwx------ 9 root root   4096 Oct 23 16:58 /root
drwx------ 4 root root   4096 Oct 23 17:00 /root/.synaptic
drwx------ 2 root root   4096 Oct 23 16:59 /root/.synaptic/tmp
-rw-r--r-- 1 root root 283682 Sep 23  2021 /root/.synaptic/tmp/tmp_sh


What's the problem here?

--
I love the way Microsoft follows standards.  In much the same manner that
fish follow migrating caribou.
               -- Paul Tomblin

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web