You are not logged in.

#1 2014-02-15 00:55:47

hippieben
Member
Registered: 2013-10-27
Posts: 218

tuning ondemand up_threshold

I've changed the up_threshold to 30 using

echo -n 30 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold

and this gives me great performance, however I can't seem to get it to stick on reboot.

I've added the above line to sysctl.conf but that doesn't work.  I feel like that's wrong, what's right?

Thanks

Offline

#2 2014-02-15 01:19:39

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: tuning ondemand up_threshold

sysctl.conf is deprecated and won't do much of anything anymore.  But besides that, even if it were still around, it takes a specific formatting and only works on things in /proc/sys.

For something like this I think you should either use tmpfiles.d, a udev rule, or make a systemd.service that takes care of this.

Offline

#3 2014-02-15 01:51:22

hippieben
Member
Registered: 2013-10-27
Posts: 218

Re: tuning ondemand up_threshold

WonderWoofy wrote:

sysctl.conf is deprecated and won't do much of anything anymore.  But besides that, even if it were still around, it takes a specific formatting and only works on things in /proc/sys.

For something like this I think you should either use tmpfiles.d, a udev rule, or make a systemd.service that takes care of this.

Thanks for your reply.  I'll probably make a systemd.service as I have a little experience there.  The computer is in use right now, so I'll have to report back later.

Offline

#4 2014-02-21 01:02:27

shutdown -h now
Member
Registered: 2012-11-07
Posts: 18

Re: tuning ondemand up_threshold

I found this thread, which advices to use systemd-tmpfiles instead of service files.

This tmpfile should do what you want (though I haven't tested it yet):

/etc/tmpfiles.d/up_threshold.conf
    w /sys/devices/system/cpu/cpufreq/ondemand/up_threshold - - - - 30

Check the wiki and man tmpfiles.d for further explanation.

EDIT: run the following to test if it works:

sudo systemd-tmpfiles --create

EDIT: it works.

Last edited by shutdown -h now (2014-02-21 02:57:57)

Offline

#5 2014-02-21 03:06:37

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: tuning ondemand up_threshold

The only thing with using tmpfiles.d to do these kinds of things is that it assumes that the directories in /sys will be present.  So during bootup there is the possibility of there being a race between the modules being fully initialized and tmpfiles.d being setup.  Though I'm not entirely sure how the dependencies line up for tmpfiles.d in relation to the probing and setting up of devices.  But tmpfiles.d is not actually intended for this use case.

tmpfiles.d man page wrote:

systemd-tmpfiles uses the configuration files from the above directories to describe the creation, cleaning and removal of volatile and temporary files and directories which usually reside in directories such as /run or /tmp.

That said, it may work just fine...

Offline

#6 2014-02-21 21:35:18

shutdown -h now
Member
Registered: 2012-11-07
Posts: 18

Re: tuning ondemand up_threshold

That is indeed a potential problem also stated in the wiki:

Note: This method may not work to set options in /sys since the systemd-tmpfiles-setup service may run before the appropriate device modules is loaded. [...] Otherwise you will have to write a udev rule to set the appropriate attribute as soon as the device appears.

Apart from that, I think it is definitely a more elegant solution then writing a custom service file with an echo in it. And with a clear and concise syntax it's more straightforward then figuring out how to write a udev rule. Which seems to me rather complicated for such a simple thing. But I've never actually written one though.

Offline

Board footer

Powered by FluxBB