You are not logged in.

#1 2012-08-15 23:16:52

Roken
Member
From: South Wales, UK
Registered: 2012-01-16
Posts: 1,366

[SOLVED] cpufreq & systemd

Just noticed a problem with cpufreq using systemd.

Before systemd I had a script that would let me change the cpufreq across all 4 cores, restarting cpufreq with /etc/rc.d/cpufreq restart.

I've got the cpufreq.service installed and running, pointing to the same /etc/conf.d/cpufreq and am restarting with systemctl restart cpufreq.service. However, now it only affects the first core. cpufreq is started from the service with the -r parameter.

Any idea how I can force it to change all 4 cores?

for info, the script is:

#!/bin/bash

confile="/etc/conf.d/cpufreq"
freq=$(zenity --list --radiolist \
--title="Select a frequency" \
--column="Select one" --column "Frquency" \
FALSE	"2.20GHz" \
FALSE	"2.70GHz" \
FALSE	"3.40GHz")

if [ -z $freq ]; then
	zenity --warning --text "Nothing changed"
	exit 1
fi

freq=`echo $freq | sed 's/GHz.*//'`
#echo $freq

sed -i -e 's/\(max\_freq\=.\).*\(.Hz.\)/\1'$freq'\2/g' $confile
systemctl restart cpufreq.service

#cat $confile
zenity --warning --text "CPU Max Frequency changed to $freq"

and cpufreq.service:

[Unit]
Description=CPU frequency scaling daemon

[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=/etc/conf.d/cpufreq
ExecStart=/usr/bin/cpufreq-set -r -g $governor -d $min_freq -u $max_freq

[Install]
WantedBy=multi-user.target

Last edited by Roken (2012-08-16 00:47:27)


Ryzen 5900X 12 core/24 thread - RTX 3090 FE 24 Gb, Asus B550-F Gaming MB, 128Gb Corsair DDR4, Fractal Design Define 7 XL, 5 HD (2 NvME PCI, 4SSD) + 1 x optical.
Linux user #545703

/ is the root of all problems.

Offline

#2 2012-08-15 23:27:03

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,734
Website

Re: [SOLVED] cpufreq & systemd

Cpufreq is about to be dropped.  Use cpupower.  See the publicdev mailing list for this discussion.

Offline

#3 2012-08-16 00:47:04

Roken
Member
From: South Wales, UK
Registered: 2012-01-16
Posts: 1,366

Re: [SOLVED] cpufreq & systemd

OK, took more work than intended (I have a comky reporting the current ferquency and had to rewrite the sed lines to extract the correct info). cpupower seems to be working as expected so, even though not a solution to cpufreq, it solved my need and marking as solved, thank you.


Ryzen 5900X 12 core/24 thread - RTX 3090 FE 24 Gb, Asus B550-F Gaming MB, 128Gb Corsair DDR4, Fractal Design Define 7 XL, 5 HD (2 NvME PCI, 4SSD) + 1 x optical.
Linux user #545703

/ is the root of all problems.

Offline

Board footer

Powered by FluxBB